3
votes

I am trying to update my apt repos inside docker container but I cannot do that.

docker run -it --dns 8.8.8.8 --dns 8.8.4.4 debian apt-get update

...

Cannot initiate the connection to httpredir.debian.org:80 (2001:41c8:1000:21::21:35). - connect (101: Network is unreachable) [IP: 2001:41c8:1000:21::21:35 80]

...

docker run -it --dns 8.8.8.8 --dns 8.8.4.4 debian apt-get -o Acquire::ForceIPv4=true update

...

W: Failed to fetch http://security.debian.org/dists/jessie/updates/Release.gpg Unable to connect to security.debian.org:http: [IP: 212.211.132.32 80]

...

2

2 Answers

1
votes

maybe refer to here ?

Like I answered there my container had no outside world network connectivity (so no DNS, etc.) where the docker host still had. thus the 'apt-get' was doomed to fail ... Restarting the whole machine (only the a restart of the docker.service didn't solve it(?)) sorted the issue. Possibly some other dependency (I suspect the firewalld) had corrupted the docker networking ???

I wonder how to "reset" the docker networking to a clean state ? I'll have to investigate this ...

0
votes

In my case, it was solved after I ran the following two commands:

sudo systemctl restart docker
sudo systemctl daemon-reload