Docker: Temporary failure resolving 'deb.debian.org'
May 2
I have a Rails application that I want to deploy using Docker on an Ubuntu server. I have the Dockerfile for the application already set up, right now I want to view the nginx conf in its container.
I ran the command below to start an nginx container in an interactive mode:
docker run -i -t nginx:latest /bin/bash
Right now I am trying to install nano editor in order to view the configuration for nginx configuration (nginx.conf) using the commands below:
apt-get update
apt-get install nano
export TERM=xterm
However, when I run the first command apt-get update, I get the error below:
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... Done
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.
I have checked very well it has nothing to do with network connectivity.
1 answer
Accepted answer · original discussion
May 2
Here's how I solved it:
Start the docker container for the application in an interactive mode, in my case it an nginx container :
docker run -i -t nginx:latest /bin/bash
Run the command below to grant read permission to the others role for the resolv.conf file:
chmod o+r /etc/resolv.conf
Note: If you are having this issue on your host machine (Ubuntu Linux OS) and not for the Docker containers, then run the same command adding sudo to it in the host machine terminal:
sudo chmod o+r /etc/resolv.conf
Endeavour to exit your bash interactive terminal once you run this:
exit
And then open a new bash interactive terminal and run the commands again:
apt-get update
apt-get install nano
export TERM=xterm
Everything should work fine now.
Reference to this on Digital Ocean: Apt error: Temporary failure resolving 'deb.debian.org'
That's all.
1 question comment
Use comments to ask for clarification. Post a solution as an answer.
Mar 21