问题:
ubuntu@VM-3-4-ubuntu:~$ docker pull tensorflow/tensorflow:2.3.4-gpu
Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
方案1 ---最后生效了,因为用的腾讯云的服务器,之前添加的都没用,直到添加了腾讯云镜像地址。。。
修改/etc/docker/daemon.json文件,并重启docker服务
{ "registry-mirrors": ["https://registry.docker-cn.com","http://hub-mirror.c.163.com","https://mirror.ccs.tencentyun.com"] }
ubuntu@VM-3-4-ubuntu:/etc/docker$ docker info Client: Context: default Debug Mode: false Plugins: app: Docker App (Docker Inc., v0.9.1-beta3) buildx: Docker Buildx (Docker Inc., v0.8.1-docker) scan: Docker Scan (Docker Inc., v0.17.0) Server: Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 0 Server Version: 20.10.14 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Native Overlay Diff: true userxattr: false Logging Driver: json-file Cgroup Driver: cgroupfs Cgroup Version: 1 Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc Default Runtime: runc Init Binary: docker-init containerd version: 3df54a852345ae127d1fa3092b95168e4a88e2f8 runc version: v1.0.3-0-gf46b6ba init version: de40ad0 Security Options: apparmor seccomp Profile: default Kernel Version: 5.4.0-96-generic Operating System: Ubuntu 20.04 LTS OSType: linux Architecture: x86_64 CPUs: 8 Total Memory: 30.86GiB Name: VM-3-4-ubuntu ID: IDVL:ZVEF:S7BH:ABOT:DMVT:ME3D:5MOZ:VWUQ:2XOJ:SDM5:YMQE:HVSD Docker Root Dir: /var/lib/docker Debug Mode: false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries: 127.0.0.0/8 Registry Mirrors: https://registry.docker-cn.com/ http://hub-mirror.c.163.com/ https://mirror.ccs.tencentyun.com/ Live Restore Enabled: false WARNING: No swap limit support
方案2 改后未生效,但操作过的
修改/etc/resolv.conf 文件 并重启docker服务
添加内容:
nameserver 8.8.8.8
nameserver 8.8.4.4
以上方案均需要执行
ubuntu@VM-3-4-ubuntu:/etc/docker$ sudo systemctl daemon-reload
ubuntu@VM-3-4-ubuntu:/etc/docker$ sudo systemctl restart docker
镜像拉取和服务器网络状态有关系