There is no network in the Docker assembly, but the launch of dockers

If I want to create my Docker file, it will not be able to connect to the network or at least DNS:

Sending build context to Docker daemon 15.95 MB Sending build context to Docker daemon Step 0 : FROM ruby ---> eeb85dfaa855 Step 1 : RUN apt-get update -qq && apt-get install -y build-essential libpq-dev ---> Running in ec8cbd41bcff W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/InRelease W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/InRelease W: Failed to fetch http://security.debian.org/dists/jessie/updates/InRelease W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/Release.gpg Could not resolve 'httpredir.debian.org' W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/Release.gpg Could not resolve 'httpredir.debian.org' W: Failed to fetch http://security.debian.org/dists/jessie/updates/Release.gpg Could not resolve 'security.debian.org' W: Some index files failed to download. They have been ignored, or old ones used instead. Reading package lists... Building dependency tree... Reading state information... E: Unable to locate package build-essential INFO[0001] The command "/bin/sh -c apt-get update -qq && apt-get install -y build-essential libpq-dev" returned a non-zero code: 100 

But if I execute the exact same command through docker run , it works:

 docker run --name="test" ruby /bin/sh -c 'apt-get update -qq && apt-get install -y build-essential libpq-dev' 

Does anyone have any ideas why docker build not working? I tried all the settings related to DNS on StackOverflow, for example, starting with dockers with -dns 8.8.8.8, etc.

Thank you in advance

+5
source share
7 answers

My docker build also failed while trying to run apt-get upgrade with the same errors. I used a docker machine on Mac OSX, and a simple docker-machine restart default solved this problem. I do not know what initially caused this, however.

+1
source

Docker definitely has network issues. I managed to solve this problem with

systemctl restart docker

... which is basically just a unix-level restart-daemon command in Debian 8.

+1
source

I had a similar problem. But when I started AWS linux, I did not have systemctl. I decided to use:

 sudo service docker restart 
+1
source

I have the same problem with raspberries.

Starting / stopping the service did not help, but reinstalling the package ( dpkg -i docker-hypriot_1.10.3-1_armhf.deb && service docker start in my case) immediately solved the situation: apt-get update manages to resolve and reach the servers.

There should be some one-time steps during the installation ...

0
source

Another case of the behavior described above is this time creating an image of dockers from Jenkins:

[...] Step 3: RUN apt-get update && & apt-get install -y curl libapache2-mod-proxy-html ---> Run in ea7aca5dea9b

Err http://security.debian.org jessie / updates InRelease

Err http://security.debian.org jessie / updates Release.gpg

Failed to resolve "security.debian.org" Err http://httpredir.debian.org jessie InRelease [...]

In my case, it turned out that DNS is not accessible from the container, but still from the docker host! (The configuration of the container converter was fine (!)) After the docker machine rebooted (a full reboot - “docker.service reboot” didn’t do the trick), it works again. So one of my actions (or my colleague) must have broken the docker network! Maybe some activity to modify firewalld ???

I'm still investigating, as I'm not sure what activities might have messed up the docker network, then ...

0
source

Also ran into the same problem today. My workaround was to reboot your docker machine. In my case, it is on VirtualBox .

Once you turn it off and then restart your computer, http://security.debian.org will be allowed.

Hope this helps.

0
source

A few suggestions, not sure if they will work or not. Can you change ...apt-get install -y... to ...apt-get install -yqq...

Also, has this image you are trying to build from changed?

-1
source

All Articles