我得到的错误:
pegasus@pegasus:~/Downloads/Docker_deb$ 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/": proxyconnect tcp: dial tcp: lookup proxy.example.com on 8.8.8.8:53: no such host.
See 'docker run --help'.
但是当我使用以下命令时出现错误。
pegasus@pegasus:~/Downloads/Docker_deb$ 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/": proxyconnect tcp: dial tcp: lookup proxy.example.com on 8.8.8.8:53: no such host.
See 'docker run --help'.
pegasus@pegasus:~$ sudo dockerd --debug
INFO[2024-06-25T04:10:55.092883645+06:00] Starting up
DEBU[2024-06-25T04:10:55.093453907+06:00] Listener created for HTTP on unix (/var/run/docker.sock)
DEBU[2024-06-25T04:10:55.110352598+06:00] Golang's threads limit set to 110340
DEBU[2024-06-25T04:10:55.110827666+06:00] metrics API listening on /var/run/docker/metrics.sock
DEBU[2024-06-25T04:10:55.113904708+06:00] Using default logging driver json-file
DEBU[2024-06-25T04:10:55.114060596+06:00] No quota support for local volumes in /var/lib/docker/volumes: Filesystem does not support, or has not enabled quotas
DEBU[2024-06-25T04:10:55.114096006+06:00] processing event stream module=libcontainerd namespace=plugins.moby
DEBU[2024-06-25T04:10:56.076431002+06:00] Cleaning up old mountid : start.
failed to start daemon: error while opening volume store metadata database (/var/lib/docker/volumes/metadata.db): timeout
查看
/etc/docker/daemon.json
文件。我可以让 docker 复制此行为的唯一方法是在 daemon.json 中设置以下内容
root@vps-b21d2eed:/etc/docker# cat daemon.json
{
"proxies": {
"http-proxy": "http://proxy.example.com:3128",
"https-proxy": "https://proxy.example.com:3129",
"no-proxy": "*.test.example.com,.example.org,127.0.0.0/8"
}
}
重新启动 docker 服务后出现此错误
root@vps-b21d2eed:/etc/docker# docker run -it hello-world
Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get "https://registry-1.docker.io/v2/": proxyconnect tcp: dial tcp: lookup proxy.example.com on 127.0.0.53:53: no such host.
See 'docker run --help'.
如果我删除
daemon.json
中的代理配置,然后运行 sudo systemctl restart docker
然后它会再次工作
root@vps-b21d2eed:/etc/docker# docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
Digest: sha256:94323f3e5e09a8b9515d74337010375a456c909543e1ff1538f5116d38ab3989
Status: Image is up to date for hello-world:latest
docker.io/library/hello-world:latest