解决docker run hello-world遇到错误消息-error during conne

2023-12-07 0 263
目录
  • docker run hello-world遇到错误消息-error during conne
  • docker安装以及docker run hello-world 不能下载镜像报错
  • 总结

docker run hello-world遇到错误消息-error during conne

执行命令行:

docker run hello-world

解决docker run hello-world遇到错误消息-error during conne

遇到错误消息:

docker: error during connect: This error may indicate that the docker daemon is not running.: Post “http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/create”: open //./pipe/docker_engine: The system cannot find the file specified.See ‘docker run –help’.

错误消息里已经解释清楚原因了:docker daemon 没有启动。

进到文件夹:C:\\Program Files\\Docker\\Docker

执行 DockerCli -switchDaemon 之后,

解决docker run hello-world遇到错误消息-error during conne

任务栏里看到这个 icon:

解决docker run hello-world遇到错误消息-error during conne

之后执行成功:

解决docker run hello-world遇到错误消息-error during conne

这条消息打印的背后,执行了这些事情:

(1) The Docker client contacted the Docker daemon.

Docker 客户端同 docker daemon 连接

(2) The Docker daemon pulled the “hello-world” image from the Docker Hub.(windows-amd64, nanoserver-1809)

因为这个命令是第一次执行,Docker daemon 从 docker hub 网站,将 hello-world 镜像下载到本地。

(3) The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading.

Docker daemon 基于下载好的镜像,创建一个新的容器,后者运行镜像,产生一条输出消息

(4) The Docker daemon streamed that output to the Docker client, which sent it to your terminal.

Docker daemon 将输出发给 docker 客户端,后者再发到 Windows 控制台。

docker安装以及docker run hello-world 不能下载镜像报错

官方Docker 的文档地址

https://docs.docker.com/engine/install/centos/

以下的代码需要连接 Linux的Centos服务器,Xshell执行

1.删除之前的版本

yum remove docker \\
docker-client \\
docker-client-latest \\
docker-common \\
docker-latest \\
docker-latest-logrotate \\
docker-logrotate \\
docker-engine

2.设置存储库 需要的安装包

yum install -y yum-utils

3.设置镜像(这里我用的是阿里云的镜像,默认是国外的太慢了)

yum-config-manager \\
–add-repo \\
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

https://pi9dpp60.mirror.aliyuncs.com 上面的网址最好用这个网址代替,这个是阿里云的个人镜像加速,上面的可能会出错,详情请向下看

4.安装最新版的Docker引擎 ce社区 ee企业

yum install docker-ce docker-ce-cli containerd.io

5.启动Docker

systemctl start docker

6.看看Docker是否安装

docker version

下图就是成功页面

解决docker run hello-world遇到错误消息-error during conne

7.hello world 测试

出现以下图片是正常

解决docker run hello-world遇到错误消息-error during conne

测试安装镜像

docker pull mysql 就会安装mysql最新版本

但是!!!!!!我出现以下错误:

docker: Error response from daemon: Head 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: read tcp 172.18.232.161:33136->54.165.240.225:443: read: connection reset by peer.See 'docker run –help'.

意思就是镜像没弄好,我们需要配置下镜像加速器就好了。

我的是阿里云的服务器,登陆到控制台-容器镜像服务-镜像加速器

将里边的,代码一行一行执行即可,如下:

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-\’EOF\’
{
\”registry-mirrors\”: [\”https://pi9dpp60.mirror.aliyuncs.com\”]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

卸载Docker

sudo yum remove docker-ce docker-ce-cli containerd.io

删除目录和卷

sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd

Docker所有的镜像都会在DockerHub上面下载。

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持悠久资源网。

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

悠久资源 Linux服务器 解决docker run hello-world遇到错误消息-error during conne https://www.u-9.cn/server/linux/115948.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务