3

when I run ubuntu as Docker container and when I run apt-get update command it gives error and fails to update the repos.

Here is what error I'm getting :

root@df167e514b29:/# sudo bash: sudo: command not found root@df167e514b29:/# apt-get update Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Temporary failure resolving 'archive.ubuntu.com' Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
Temporary failure resolving 'security.ubuntu.com' Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease Temporary failure resolving 'archive.ubuntu.com' Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease Temporary failure resolving 'archive.ubuntu.com' Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Temporary failure resolving 'archive.ubuntu.com' W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Temporary failure resolving 'archive.ubuntu.com' W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Temporary failure resolving 'archive.ubuntu.com' W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Temporary failure resolving 'security.ubuntu.com' W: Some index files failed to download. They have been ignored, or old ones used instead. root@df167e514b29:/#

  • How do enter the Docker container? What is the host system? See https://askubuntu.com/a/1162198/66509 for possible solution. – N0rbert Aug 20 '19 at 13:29
  • actually I got solution for this thing. the problem was that internet connection I am using is at enterprise level, so I need to manually setup DNS server for docker. this thing sorted out the problem. – pbhadu21 Aug 20 '19 at 16:36
  • 1
    I'll recommend you to write an answer for your question. This will help other users if they face the same problem. – N0rbert Aug 20 '19 at 16:48

1 Answers1

0

the problem was with Internet connection, as mine connection is at enterprise level and because of that It was unable to execute apt-get update command. Solution worked for me is :

  1. find your DNS server address using cat /etc/resolv.conf

  2. Open Docker confg file and uncomment DOCKER_OPTS and add your DNS server over there

Docker config file : sudo gedit /etc/default/docker