【亲测可用】Ubuntu服务器安装docker,Docker安装完成运行hello-world镜像失败:Unable to find image ‘hello-world:latest‘ locall
参考:
参考1、
10分钟学会Docker的安装和使用_docker安装-CSDN博客
参考2、
【完全解决】Docker安装完成运行hello-world镜像失败:Unable to find image ‘hello-world:latest‘ locallylatest:_unable to find image 'hello-world:latest' locally-CSDN博客
在参考2的评论区获得镜像地址如下:
🔥最新更新!国内仍然可用docker镜像加速器汇总(2025年8月) - Kelen

下面是docker安装过程
安装环境是:Ubuntu
更新apt包索引
sudo apt-get update
安装必要工具包
sudo apt-get install
apt-transport-https
ca-certificates
curl
gnupg-agent
software-properties-common
添加Docker GPG秘钥--我用的国内源
# 1. 默认使用国外源,非常非常非常慢!
$ sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# 2. 推荐使用国内源,顺畅!
$ sudo curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
配置仓库源--我用的国内源
# 1. 默认使用国外源,非常非常非常慢!
$ sudo add-apt-repository
"deb [arch=amd64] https://download.docker.com/linux/ubuntu
$(lsb_release -cs)
stable"
# 2. 推荐使用国内源,顺畅!
$ sudo add-apt-repository
"deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu
$(lsb_release -cs)
stable"
安装Docker Engine
# 更新apt包索引
$ sudo apt-get update
# 安装docker
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
启动Docker
sudo systemctl enable docker
sudo systemctl start docker
验证安装是否成功
sudo docker run hello-world
问题:
镜像拉取失败,这在国内服务器非常常见,因为默认 Docker Hub 访问慢甚至被防火墙阻挡。问题不是 Docker 本身,而是网络。
$ 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/": context deadline exceeded
Run 'docker run --help' for more information
解决方案:
配置国内镜像加速器
-
创建或编辑 Docker 配置文件:
sudo mkdir -p /etc/docker
sudo nano /etc/docker/daemon.json
2、在文件里写入国内镜像地址--亲测可用!!!!
{
"registry-mirrors": [
"https://docker.xuanyuan.me/",
"https://docker.1ms.run",
"https://docker.1panel.live",
"https://hub.rat.dev",
"https://doublezonline.cloud",
"https://docker.mrxn.net",
"https://docker.anyhub.us.kg",
"https://dislabaiot.xyz",
"https://docker.fxxk.dedyn.io",
"https://docker-mirror.aigc2d.com",
"https://docker.mirrors.ustc.edu.cn/",
"https://registry.docker-cn.com/",
"https://registry.cn-hangzhou.aliyuncs.com"
]
}
3、保存并退出 nano
-
按
Ctrl + o→ 回车(保存) -
按
Ctrl + x→ 退出
4、重启 Docker:
sudo systemctl daemon-reload
sudo systemctl restart docker
5、再次测试:成功!!!!
sudo docker run hello-world
# 输出以下信息说明成功
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
17eec7bbc9d7: Pull complete
Digest: sha256:a0dfb02aac212703bfcb339d77d47ec32c8706ff250850ecc0e19c8737b18567
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/









