解决docker run hello-world遇到错误消息-error during conne
docker run hello-world遇到错误消息-error during conne
执行命令行:
docker run hello-world
遇到错误消息:
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 之后,
任务栏里看到这个 icon:
之后执行成功:
这条消息打印的背后,执行了这些事情:
(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
下图就是成功页面
7.hello world 测试
出现以下图片是正常
测试安装镜像
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上面下载。
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。
相关文章
IntelliJ IDEA(2018版)安装docker插件的详细过程
这篇文章主要介绍了IntelliJ IDEA安装docker插件的详细过程,开发工具使用的是IDEA2018.16版,本文通过图文实例相结合给大家介绍的非常详细,需要的朋友可以参考下2021-09-09Docker快速搭建PHP+Nginx+Mysql环境及踩坑
本文主要介绍了Docker快速搭建PHP+Nginx+Mysql环境及踩坑 ,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧2022-08-08使用Docker-compose离线部署Django应用的方法
这篇文章主要介绍了使用Docker-compose离线部署Django应用的方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧2019-03-03docker<容器数据卷-v>对容器内数据持久化详解(备份)
容器的数据持久化主要是指宿主机与容器,以及容器与容器之间进行数据交互,下面这篇文章主要给大家介绍了关于docker<容器数据卷-v>对容器内数据持久化的相关资料,需要的朋友可以参考下2023-03-03Docker可视化ui管理工具Portainer安装及使用解析
这篇文章主要介绍了Docker可视化ui管理工具Portainer安装及使用解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下2020-11-11
最新评论