问题描述
Ubuntu配置国内Docker Hub 镜像缓存无效
问题出现的平台版本及自己尝试过哪些方法
OS version:Ubuntu 18.04、Raspbian buster
按照中科大和清华镜像使用说明,以中科大镜像地址为例
对于使用 systemd 的系统(Ubuntu 16.04+、Debian 8+、CentOS 7), 在配置文件 /etc/docker/daemon.json 中加入:
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"]
}
重新启动 dockerd:
sudo systemctl restart docker
但是依然无效
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
未添加镜像地址错误代码:
$ docker pull hello-world
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: TLS handshake timeout
添加镜像地址后错误代码:
$ docker pull hello-world
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/library/hello-world/manifests/latest: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fhello-world%3Apull&service=registry.docker.io:
net/http: TLS handshake timeout
docker info:
$ docker info
Client:
Debug Mode: false
Server:
Containers: 2
Running: 0
Paused: 0
Stopped: 2
Images: 2
Server Version: 19.03.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
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: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.0.0-27-generic
Operating System: Ubuntu 18.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 7.642GiB
Name: hailin-XPS-15-9560
ID: MFEG:4FBM:PWNQ:5L5D:6EIC:4SHZ:WGHG:3YFK:HTZ3:NZUG:7KXX:XXAI
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://docker.mirrors.ustc.edu.cn/
Live Restore Enabled: false
WARNING: No swap limit support
请问应该怎么做才能得到稳定快速的docker hub pull效果?
很奇怪的问题啊……
拉镜像的时候强行指定一下源呢?像这样: