Unable to sudo apt-get update in Docker container

Asked 2 years ago, Updated 2 years ago, 61 views

pytorch/pytorch: 1.5-cuda 10.1-cudnn7-develCreate a Docker container based on the image
When I ran sudo apt-get update, I encountered the following error:

The reason seems to be the inability to access developer.download.nvidia.com.
I couldn't figure out how to deal with it, so I decided to consult with you.

The host environment is Ubuntu 18.04.3 LTS.

I look forward to your kind cooperation.

Error executing command

<username>@<hostname>:/$sudo apt-get update
Err:1 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 InRelease                                   
  Could not connect to developer.download.nvidia.com:443 (152.199.39.144), connection timed out
Err:2 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 InRelease                       
  Enable to connect to developer.download.nvidia.com:https:
Err:3 http://archive.ubuntu.com/ubuntubionic InRelease                                                  
  Could not connect to archive.ubuntu.com:80 (91.189.88.142), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.88.152), connection timed out
Err:4 http://archive.ubuntu.com/ubuntubionic-updates InRelease                                          
  Enable to connect to archive.ubuntu.com:http:
Err:5 http://archive.ubuntu.com/ubuntubionic-backports InRelease
  Enable to connect to archive.ubuntu.com:http:
Err:6 http://security.ubuntu.com/ubuntubionic-security InRelease
  Could not connect to security.ubuntu.com:80 (91.189.88.152), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.38), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.39), connection timed out Could not connect to security.ubuntu.com:80 (91.189.88.142), connection timed out
Reading package lists... Done                         
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Could not connect to archive.ubuntu.com:80 (91.189.88.142), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.88.152), connection timed out
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Unable to connect to archive.ubuntu.com:http:
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Unable to connect to archive.ubuntu.com:http:
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Could not connect to security.ubuntu.com:80 (91.189.88.152), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.38), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.39), connection timed out Could not connect to security.ubuntu.com:80 (91.189.88.142connection timed out)
W: Failed to fetch https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/InRelease Could not connect to developer.download.nvidia.com:443 (152.199.39.144), connection timed out
W: Failed to fetch https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/InRelease Unable to connect to developer.download.nvidia.com:https:
W: Some index files failed to download. They have been ignored, or old ones used installed.

linux ubuntu docker

2022-09-30 15:37

1 Answers

Now that I've solved myself, I'll leave a self-answer just in case.

I couldn't sudo it with a user other than root, but as shown below
I was able to update apt-get by re-entering the container as the root user.

$docker exec-it-u root<container ID>bash
root@<container name>:/$apt-get update


2022-09-30 15:37

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.