`pytorch/pytorch:1.5-cuda10.1-cudnn7-devel` イメージをベースにDockerコンテナを作成して  
`sudo apt-get update` を実行したところ、下記のようなエラーが発生してしまいました。

developer.download.nvidia.com にアクセスできないことが原因のようですが、  
対処方法の検討がつかなかったのでこちらで相談させていただくことにしました。

ホスト環境は Ubuntu 18.04.3 LTS です。

ご教授の程、何卒宜しくお願い致します。

* * *

**コマンド実行のエラー**

```

    <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                       
      Unable to connect to developer.download.nvidia.com:https:
    Err:3 http://archive.ubuntu.com/ubuntu 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
    Err:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease                                          
      Unable to connect to archive.ubuntu.com:http:
    Err:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
      Unable to connect to archive.ubuntu.com:http:
    Err:6 http://security.ubuntu.com/ubuntu 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.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.142), connection 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 instead.
    
```
CC BY-SA 4.0
2020-06-17T06:50:33.723
67752
2020-06-17T16:37:13.677
2020-06-17T16:36:39.003
3060
30280
question
linux ubuntu docker
Dockerコンテナ内でsudo apt-get updateが出来ない
自己解決しましたので、一応自己回答を残しておきます。

root以外のユーザーでsudoしてもできなかったのですが、下記のように  
rootユーザーでコンテナに入りなおしてから実行すれば、apt-getを更新することが出来ました。

```

    $ docker exec -it -u root <container ID> bash
    root@<container name>:/$ apt-get update
    
```
CC BY-SA 4.0
2020-06-17T16:25:16.480
67764
2020-06-17T16:37:13.677
2020-06-17T16:37:13.677
3060
30280
67752
answer