Ubuntu安装docker run hello-world无法连接仓库?

浏览:65日期:2023-02-18

问题描述

在按照docker官网的安装步骤安装好后,运行hello-world结果出现:

:~$ sudo docker run hello-worldUnable to find image ’hello-world:latest’ locallydocker: Error response from daemon: Get https://registry-1.docker.io/v2/: write tcp 10.11.66.20:49182->50.17.62.194:443: write: connection reset by peer.See ’docker run --help’.:~$ sudo docker login -u'gaoxi1993' -p'xxx'Error response from daemon: Get https://registry-1.docker.io/v2/: Get https://auth.docker.io/token?account=gaoxi1993&client_id=docker&offline_token=true&service=registry.docker.io: read tcp 10.11.66.20:48290->50.17.62.194:443: read: connection reset by peer

我的docker版本信息

:~$ sudo docker version Client: Version: 17.03.0-ce API version: 1.26 Go version: go1.7.5 Git commit: 3a232c8 Built:Tue Feb 28 08:01:32 2017 OS/Arch: linux/amd64Server: Version: 17.03.0-ce API version: 1.26 (minimum version 1.12) Go version: go1.7.5 Git commit: 3a232c8 Built:Tue Feb 28 08:01:32 2017 OS/Arch: linux/amd64 Experimental: false:~$ sudo docker infoContainers: 0 Running: 0 Paused: 0 Stopped: 0Images: 0Server Version: 17.03.0-ceStorage Driver: aufs Root Dir: /var/lib/docker/aufs Backing Filesystem: extfs Dirs: 0 Dirperm1 Supported: trueLogging Driver: json-fileCgroup Driver: cgroupfsPlugins: Volume: local Network: bridge host macvlan null overlaySwarm: inactiveRuntimes: runcDefault Runtime: runcInit Binary: docker-initcontainerd version: 977c511eda0925a723debdc94d09459af49d082arunc version: a01dafd48bc1c7cc12bdb01206f9fea7dd6feb70init version: 949e6faSecurity Options: apparmor seccomp Profile: defaultKernel Version: 4.4.0-66-genericOperating System: Ubuntu 16.04.2 LTSOSType: linuxArchitecture: x86_64CPUs: 4Total Memory: 15.12 GiBName: simer-ThinkPad-Edge-E330ID: GJOM:LQNO:UZ7V:X2FM:O4ZI:FPFI:F6WN:NC2W:AIVP:PYKJ:F7PP:KZZWDocker Root Dir: /var/lib/dockerDebug Mode (client): falseDebug Mode (server): falseUsername: gaoxi1993Registry: https://index.docker.io/v1/WARNING: No swap limit supportExperimental: falseInsecure Registries: 127.0.0.0/8Live Restore Enabled: false

检查dns

:~$ nslookup auth.docker.ioServer:127.0.1.1Address: 127.0.1.1#53Non-authoritative answer:Name: auth.docker.ioAddress: 52.5.246.212Name: auth.docker.ioAddress: 50.17.62.194Name: auth.docker.ioAddress: 34.193.147.40

个人电脑信息

:~$ uname -aLinux ThinkPad-Edge 4.4.0-66-generic #87-Ubuntu SMP Fri Mar 3 15:29:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

2017年03月12日19:52补充换到家里的网络重启电脑后,第一次会出现

:~$ sudo docker run hello-worldUnable to find image ’hello-world:latest’ locallydocker: Error response from daemon: Get https://registry-1.docker.io/v2/library/hello-world/manifests/latest: read tcp 192.168.0.7:53058->50.17.62.194:443: read: connection reset by peer.See ’docker run --help’.:~$ sudo docker run hello-worldUnable to find image ’hello-world:latest’ locallylatest: Pulling from library/hello-world78445dd45222: Pull complete Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7Status: Downloaded newer image for hello-world:latestHello from Docker!

貌似是网络环境问题,真是见鬼了,目前已正常使用。

问题解答

回答1:

国内的网络原因你懂的。可以使用一些国内的docker镜像,比如daocloud,时速云,灵雀云等,他们都提供了镜像加速

回答2:

docker在使用的时候,很多命令需要调用/var/run/docker.sock但是docker.sock需要较高的权限.解决方法:1.docker.sock权限授予用户2.切换到root(ubuntu 使用 sudo su 切换)

回答3:

同样的docker版本,已加入docker用户组,也是遇到这个问题。同样的命令,一会儿报:

Error response from daemon: Get https://registry-1.docker.io/... read tcp 192.168.1.170:49652->50.17.62.194:443: read: connection reset by peer

再过一会运行又是正常的,不知道网络哪里出问题了

2017-03-26改为使用中科大的源了,速度还比较快https://lug.ustc.edu.cn/wiki/...

相关文章: