Server Fault Asked by dobson on November 28, 2020
I am on CentOS 8.
The second step in my Dockerfile tries to update the system, but for some reason, it keeps saying that it is having trouble resolving deb.debian.org
and security.debian.org
, so the update fails.
Step 2/13 : RUN apt-get update && apt-get -y install
---> Running in fa042e27e301
Err:1 http://security.debian.org/debian-security buster/updates InRelease
Temporary failure resolving 'security.debian.org'
Err:2 http://deb.debian.org/debian buster InRelease
Temporary failure resolving 'deb.debian.org'
Err:3 http://deb.debian.org/debian buster-updates InRelease
Temporary failure resolving 'deb.debian.org'
Reading package lists...
W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease Temporary failure resolving 'security.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease Temporary failure resolving 'deb.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...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
I tried pinging the domains it failed to resolve and it worked, so I’m confused on why it fails in the container.
I then tried creating a docker container from Debian without any other commands. Once in the new container, the same issue occurs (can’t update system), then I try pinging deb.debian.org
& google.com
, both times it spits out this error (when I did the same thing but on an alpine container, the ping worked, so something is wrong specifically with Debian):
ping: deb.debian.org: Temporary failure in name resolution
My /etc/docker/daemon.json
:
{
"dns": ["1.1.1.1", "8.8.8.8"]
}
I have a VM with basically the same configuration, to test out containers before publishing them on my host pc. The error I’m getting above happened on my VM, but after a reboot, it fixed itself. After rebooting the host pc, the error persists.
This would allow networking to masquerade that of the host:
sudo firewall-cmd --zone=public --add-masquerade --permanent
sudo firewall-cmd --zone=public --add-port=80/tcp
sudo firewall-cmd --zone=public --add-port=443/tcp
sudo firewall-cmd --reload
You could also disable firewalld
, but this is the more friendly solution in my opinion.
Answered by Shawn Bertrand on November 28, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP