Docker運(yùn)行hello-world鏡像失敗或超時(shí)的問(wèn)題
docker run hello-world時(shí)超時(shí)告警
? 跟著官方文檔進(jìn)行docker安裝時(shí),測(cè)試docker是否運(yùn)行成功執(zhí)行docker run hello-world時(shí),結(jié)果和別人的不一樣
正常情況:

我們的:

Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world c1ec31eb5944: Retrying in 10 seconds docker: error pulling image configuration: download failed after attempts=6: dial tcp 128.242.245.93:443: connect: connection refused. See 'docker run --help'.
原因:就是我們的鏡像源不行,需要更換鏡像源
但是我們就算知道原因,去找度娘會(huì)發(fā)現(xiàn)大部分都是說(shuō)更換阿里的鏡像源,但是我們嘗試之后并沒(méi)有作用
常規(guī)方案沒(méi)作用
#針對(duì)Docker客戶端版本大于 1.10.0 的用戶
#您可以通過(guò)修改daemon配置文件/etc/docker/daemon.json來(lái)使用加速器
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://5nkcn10r.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker2.1、解決方案
配置加速地址:設(shè)置registry mirror
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": [
"https://do.nark.eu.org",
"https://dc.j8.work",
"https://docker.m.daocloud.io",
"https://dockerproxy.com",
"https://docker.mirrors.ustc.edu.cn",
"https://docker.nju.edu.cn"
]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
systemctl status docker重啟完docker之后檢查registry mirror剛剛配置的加速地址是否成功
[root@wzy1303 docker]# docker info
Client: Docker Engine - Community
Version: 26.1.4
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.14.1
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.27.1
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 1
Server Version: 26.1.4
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Using metacopy: false
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 splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: d2d58213f83a351ca8f528a95fbd145f5654e957
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
seccomp
Profile: builtin
Kernel Version: 3.10.0-1160.119.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 2.761GiB
Name: wzy1303
ID: 74efae68-ef43-45a9-b547-ffa2c3805423
Docker Root Dir: /var/lib/docker
Debug Mode: false
Username: inkling1303
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://do.nark.eu.org/
https://dc.j8.work/
https://docker.m.daocloud.io/
https://dockerproxy.com/
https://docker.mirrors.ustc.edu.cn/
https://docker.nju.edu.cn/
Live Restore Enabled: false可以看到我們已經(jīng)配置成功:

運(yùn)行docker run hello-world,成功運(yùn)行
[root@wzy1303 docker]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c1ec31eb5944: Pull complete
Digest: sha256:53cc4d415d839c98be39331c948609b659ed725170ad2ca8eb36951288f81b75
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
#查看是否成功拉取hello-world鏡像
[root@wzy1303 docker]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest d2c94e258dcb 15 months ago 13.3kB
[root@wzy1303 docker]# docker images -a
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest d2c94e258dcb 15 months ago 13.3kB
[root@wzy1303 docker]# docker images -aq
d2c94e258dcb到此這篇關(guān)于Docker運(yùn)行hello-world鏡像失敗或超時(shí)的問(wèn)題的文章就介紹到這了,更多相關(guān)Docker hello-world超時(shí)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
windows壞境下docker使用phpmyamin的權(quán)限問(wèn)題解決
這篇文章主要為大家介紹了windows壞境下docker使用phpmyamin發(fā)生的權(quán)限問(wèn)題解決分析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-12-12
Ubuntu24.04LTS在線安裝Docker引擎的詳細(xì)過(guò)程
本文介紹了在Ubuntu 24.04 LTS系統(tǒng)上安裝Docker引擎的步驟,包括卸載舊版本、設(shè)置Docker APT倉(cāng)庫(kù)、安裝最新版或指定版本的Docker,本文給大家介紹的非常詳細(xì),感興趣的朋友跟隨小編一起看看吧2024-11-11
Docker 安裝 Jenkins 并解決初始安裝插件失敗問(wèn)題
這篇文章主要介紹了Docker 安裝 Jenkins 并解決初始安裝插件失敗問(wèn)題,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-04-04
詳解Docker如何啟動(dòng)一個(gè)Centos鏡像
本篇文章主要介紹了詳解Docker如何啟動(dòng)一個(gè)Centos鏡像,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-05-05
docker部署Nestjs的簡(jiǎn)單配置實(shí)現(xiàn)
使用Docker部署NestJS應(yīng)用程序可以確保在不同的環(huán)境中運(yùn)行一致,并且避免了由于依賴關(guān)系或配置問(wèn)題導(dǎo)致的部署錯(cuò)誤,本文主要介紹了docker來(lái)部署Nestjs的簡(jiǎn)單配置,感興趣的可以了解一下2024-02-02
docker部署vue項(xiàng)目的實(shí)現(xiàn)步驟
本文主要介紹了docker部署vue項(xiàng)目的實(shí)現(xiàn)步驟,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2023-07-07

