unable to update ubuntu Docker container using apt-get update

10,254

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

Share:
10,254

Related videos on Youtube

pbhadu21
Author by

pbhadu21

Updated on September 18, 2022

Comments

  • pbhadu21
    pbhadu21 over 1 year

    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:/#

    • N0rbert
      N0rbert over 4 years
      How do enter the Docker container? What is the host system? See askubuntu.com/a/1162198/66509 for possible solution.
    • pbhadu21
      pbhadu21 over 4 years
      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.
    • N0rbert
      N0rbert over 4 years
      I'll recommend you to write an answer for your question. This will help other users if they face the same problem.
  • Henke
    Henke over 3 years
    What solved it for me is askubuntu.com/questions/1162163#1162198.