LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-14-2020, 05:13 PM   #1
burgas
LQ Newbie
 
Registered: Sep 2020
Posts: 22

Rep: Reputation: Disabled
apt-get not working inside docker


I want to start something based on ubuntu:xenial but apt-get not working
most strange in my case that any command for buzybox like nslookup, ping gateway and so on, working fine.
Can anybody advice for me? How to fix this issue inside docker container?
Attached Thumbnails
Click image for larger version

Name:	Docker-T142020_2034471.png
Views:	73
Size:	16.1 KB
ID:	34571   Click image for larger version

Name:	Docker-T152020_0107101.png
Views:	55
Size:	91.5 KB
ID:	34572   Click image for larger version

Name:	Docker-T152020_0155041.png
Views:	54
Size:	128.7 KB
ID:	34574  

Last edited by burgas; 11-14-2020 at 05:58 PM.
 
Old 11-15-2020, 11:38 AM   #2
jmgibson1981
Senior Member
 
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Debian
Posts: 1,141

Rep: Reputation: 392Reputation: 392Reputation: 392Reputation: 392
How did you install Docker. If you installed as per the instructions on https://docs.docker.com/engine/install/ubuntu/ then did you follow the final configuration? Namely https://docs.docker.com/engine/insta...x-postinstall/ . Most of it I find useless or already done in my configuration. This part however is necessary.

Quote:
Specify DNS servers for Docker
The default location of the configuration file is /etc/docker/daemon.json. You can change the location of the configuration file using the --config-file daemon flag. The documentation below assumes the configuration file is located at /etc/docker/daemon.json.

Create or edit the Docker daemon configuration file, which defaults to /etc/docker/daemon.json file, which controls the Docker daemon configuration.

$ sudo nano /etc/docker/daemon.json
Add a dns key with one or more IP addresses as values. If the file has existing contents, you only need to add or edit the dns line.

{
"dns": ["8.8.8.8", "8.8.4.4"]
}
If your internal DNS server cannot resolve public IP addresses, include at least one DNS server which can, so that you can connect to Docker Hub and so that your containers can resolve internet domain names.

Save and close the file.

Restart the Docker daemon.

$ sudo service docker restart
Verify that Docker can resolve external IP addresses by trying to pull an image:

$ docker pull hello-world
If necessary, verify that Docker containers can resolve an internal hostname by pinging it.

$ docker run --rm -it alpine ping -c4 <my_internal_host>

PING google.com (192.168.1.2): 56 data bytes
64 bytes from 192.168.1.2: seq=0 ttl=41 time=7.597 ms
64 bytes from 192.168.1.2: seq=1 ttl=41 time=7.635 ms
64 bytes from 192.168.1.2: seq=2 ttl=41 time=7.660 ms
64 bytes from 192.168.1.2: seq=3 ttl=41 time=7.677 ms
Here is mine with my local dns.

Code:
{
        "dns": ["192.168.1.2", "8.8.8.8", "8.8.4.4"]
}

Last edited by jmgibson1981; 11-15-2020 at 11:41 AM.
 
Old 11-15-2020, 03:24 PM   #3
burgas
LQ Newbie
 
Registered: Sep 2020
Posts: 22

Original Poster
Rep: Reputation: Disabled
Thank you, jmgibson1981, for answer
But in docker documentation I don't see anything information about file /etc/docker/daemon.json
I see documentation about file /etc/default/docker
Of course I tune this file and set up DNS in this file

# Use DOCKER_OPTS to modify the daemon startup options.
DOCKER_OPTS="--dns 8.8.8.8 --dns 1.1.1.1"

also DNS information can be set for each container creation, I use portainer, and in portainer I see overriding DNS parameters for each container creation

in my case /etc/docker/ now contains file key.json

{
"crv":"P-256",
"d":"M3232wECpwzHLRhXG4H-mTUjw7fGA3o0noJ2siLBiZDr4",
"kid":"6Q1GY:G2FY:N754:NLP7:KYLD:YH4P:LvBL:GD6Z:WZ2T:7S5V:NX45:ZTX5",
"kty":"EC",
"x":"zl2xyZR_ETQQW131312EgC3SssdDVy29Di7HnnTxjFZ2JU",
"y":"X2ZxqpEbbAV82xDz567566F4JRj0lGm3Kw7Akl8hW4NUmc"
}

However, I try you idea - add additional DNS definition and restart docker.
Unfortunately nothing changing....

In my case Hello-world docker working correctly, Portainer working correctly, even Busybox working absolutely correctly (any network utilities working fine), only Ubuntu don't working at all. In CentOS in my case working only ping.
Attached Thumbnails
Click image for larger version

Name:	Docker-T152020_2318511.png
Views:	18
Size:	101.4 KB
ID:	34583   Click image for larger version

Name:	Docker-T152020_2319041.png
Views:	16
Size:	108.2 KB
ID:	34584   Click image for larger version

Name:	Docker-T162020_0019001.png
Views:	14
Size:	60.7 KB
ID:	34585  

Last edited by burgas; 11-15-2020 at 04:28 PM.
 
Old 11-16-2020, 05:50 AM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by burgas View Post
But in docker documentation I don't see anything information about file /etc/docker/daemon.json
See https://docs.docker.com/engine/refer...iguration-file.
 
1 members found this post helpful.
Old 11-16-2020, 03:25 PM   #5
burgas
LQ Newbie
 
Registered: Sep 2020
Posts: 22

Original Poster
Rep: Reputation: Disabled
hmmm. interesting, at common my datacenter working with special MTU size, maybe problem close to there.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] APT error and Command Line help. apt-get not working Rookes123 Linux - Laptop and Netbook 9 02-11-2019 10:12 AM
Not able to run this command "sudo apt-get install libdevil-dev" even after trying "apt-get -f install" getting below error message srihariu1 Linux - Embedded & Single-board computer 2 04-26-2018 06:33 AM
LXer: Ubuntu LXD: Not a Docker replacement, a Docker enhancement LXer Syndicated Linux News 0 11-05-2014 08:40 PM
LXer: Docker Founder Explains What Docker is all About LXer Syndicated Linux News 0 08-21-2014 09:20 PM
apt-get install not working / apt-get update is ok remy215 Debian 2 10-01-2005 07:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration