apt-get update: Temporary failure resolving '*' In Docker Container

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 and, so the update fails.

Step 2/13 : RUN apt-get update && apt-get -y install
 ---> Running in fa042e27e301
Err:1 buster/updates InRelease
  Temporary failure resolving ''
Err:2 buster InRelease
  Temporary failure resolving ''
Err:3 buster-updates InRelease
  Temporary failure resolving ''
Reading package lists...
W: Failed to fetch  Temporary failure resolving ''
W: Failed to fetch  Temporary failure resolving ''
W: Failed to fetch  Temporary failure resolving ''
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 &, 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: Temporary failure in name resolution

My /etc/docker/daemon.json:

    "dns": ["", ""]

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.

One Answer

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

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP