AnswerBun.com

apt-get update: Temporary failure resolving '*.debian.org' 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 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.

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!

Related Questions

How do i mount a Raid disk in linux

2  Asked on January 25, 2021

 

AH01630: client denied by server configuration Apache

3  Asked on January 24, 2021 by koulapic

     

Postfix/Dovecot-LMTP configuration confusion

2  Asked on January 24, 2021 by user8056359

         

Cannot sign in to aws console

0  Asked on January 22, 2021 by rosencreuz

     

Router drops connection

1  Asked on January 22, 2021 by deniz-zoeteman

     

Windows 10 computer won’t update

2  Asked on January 22, 2021 by hagen-von-eitzen

     

Error while mounting partition with Live CD

1  Asked on January 21, 2021 by sat

     

logrotate not rotating the logs

4  Asked on January 21, 2021 by carmen

 

How to troubleshoot GRE tunnel issues?

1  Asked on January 21, 2021 by linux911

     

Dell PowerEdge R430 iDRAC8 snmp OIDs for hardware

1  Asked on January 20, 2021 by alex_90

 

Snort in KVM machines

1  Asked on January 20, 2021 by emilio-macias

   

check_nrpe: ssocket time out after 10 seconds

1  Asked on January 19, 2021 by suganya

       

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir