bash
adele@ubuntu:~$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
docker: 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).
See 'docker run --help'.
解决方案:
bash
sudo vim /etc/docker/daemon.json
插入镜像源
bash
{
"registry-mirrors":["https://docker.registry.cyou",
"https://docker-cf.registry.cyou",
"https://dockercf.jsdelivr.fyi",
"https://docker.jsdelivr.fyi",
"https://dockertest.jsdelivr.fyi",
"https://mirror.aliyuncs.com",
"https://dockerproxy.com",
"https://mirror.baidubce.com"
"https://docker.m.daocloud.io"
"https://docker.nju.edu.cn",
"https://docker.mirrors.sjtug.sjtu.edu.cn"
"https://docker.mirrors.ustc.edu.cn"
"https://mirror.iscas.ac.cn"
"https://docker.rainbond.cc"]
}
查看一下
bash
adele@ubuntu:~$ cat /etc/docker/daemon.json
{
"registry-mirrors": [
"https://docker.registry.cyou",
"https://docker-cf.registry.cyou",
"https://dockercf.jsdelivr.fyi",
"https://docker.jsdelivr.fyi",
"https://dockertest.jsdelivr.fyi",
"https://mirror.aliyuncs.com",
"https://dockerproxy.com",
"https://mirror.baidubce.com",
"https://docker.m.daocloud.io",
"https://docker.nju.edu.cn",
"https://docker.mirrors.sjtug.sjtu.edu.cn",
"https://docker.mirrors.ustc.edu.cn",
"https://mirror.iscas.ac.cn",
"https://docker.rainbond.cc"
]
}
成功。然后重启
bash
sudo systemctl daemon-reload
sudo systemctl restart docker
systemctl status docker
bash
adele@ubuntu:~$ sudo systemctl daemon-reload
adele@ubuntu:~$ sudo systemctl restart docker
adele@ubuntu:~$ systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: e
Active: active (running) since Fri 2024-12-20 17:22:15 CST; 43s ago
Docs: https://docs.docker.com
Main PID: 3069 (dockerd)
Tasks: 9
CGroup: /system.slice/docker.service
└─3069 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/contain
12月 20 17:22:15 ubuntu dockerd[3069]: time="2024-12-20T17:22:15.309688841+08:00
12月 20 17:22:15 ubuntu dockerd[3069]: time="2024-12-20T17:22:15.310469597+08:00
12月 20 17:22:15 ubuntu dockerd[3069]: time="2024-12-20T17:22:15.310604555+08:00
12月 20 17:22:15 ubuntu dockerd[3069]: time="2024-12-20T17:22:15.311577345+08:00
12月 20 17:22:15 ubuntu dockerd[3069]: time="2024-12-20T17:22:15.450661774+08:00
12月 20 17:22:15 ubuntu dockerd[3069]: time="2024-12-20T17:22:15.490279840+08:00
12月 20 17:22:15 ubuntu dockerd[3069]: time="2024-12-20T17:22:15.542149211+08:00
12月 20 17:22:15 ubuntu dockerd[3069]: time="2024-12-20T17:22:15.543871903+08:00
12月 20 17:22:15 ubuntu systemd[1]: Started Docker Application Container Engine.
12月 20 17:22:15 ubuntu dockerd[3069]: time="2024-12-20T17:22:15.572200859+08:00
启动成功
测试运行
成功。