[英]docker run hello-world - unable to find image
I installed latest docker version on remote Centos7.2 (version 18.01.0.ce) according the docker install instruction.我根据 docker install 指令在远程 Centos7.2(版本 18.01.0.ce)上安装了最新的 docker 版本。
My docker client and docker server are on the same machine (Virtual machine).我的 docker 客户端和 docker 服务器在同一台机器上(虚拟机)。 when running
sudo docker run hello-world
I get当运行
sudo docker run hello-world
我得到
"Unable to find image 'hello-world:latest' locally
“无法在本地找到图像 'hello-world:latest'
docker: Error response from daemon: Get https://registry-1.docker.io/v2/ : >net/http: request canceled while waiting for connection (Client.Timeout >exceeded while awaiting headers).docker:来自守护进程的错误响应:获取https://registry-1.docker.io/v2/ :>net/http:请求在等待连接时被取消(Client.Timeout >exceeded while awaiting headers)。 See 'docker run --help'."
参见‘docker run --help’。”
Any suggestions on how to solve it?关于如何解决它的任何建议?
The first time you run docker container run hello-world
the system will not be able to find the image(container) locally so it should automatically attempt to download the container - it did in my case.第一次运行
docker container run hello-world
系统将无法在本地找到图像(容器),因此它应该自动尝试下载容器 - 在我的情况下是这样。
Also looks like a connection issue with docker.io you might want to try later or check your internet connection settings.也看起来像 docker.io 的连接问题,您可能想稍后尝试或检查您的互联网连接设置。
Make sure you have internet access on that virtual machine.确保您可以在该虚拟机上访问 Internet。
When you run non-existing docker image, docker engine connects to docker hub and download that image.当您运行不存在的 docker 镜像时,docker 引擎会连接到 docker hub 并下载该镜像。
I have also met this issue when I try to run centos 7 docker from docker hub:当我尝试从 docker hub 运行centos 7 docker 时,我也遇到了这个问题:
docker run -it centos:7
The first message issued was:发出的第一条消息是:
Unable to find image 'centos:7' locally
无法在本地找到图像“centos:7”
After a while, I saw the following message:过了一会儿,我看到了以下消息:
7: Pulling from library/centos Digest: sha256:307835c385f656ec2e2fec602cf093224173c51119bbebd602c53c3653a3d6eb Status: Downloaded newer image for centos:7
7:从库/centos 提取摘要:sha256:307835c385f656ec2e2fec602cf093224173c51119bbebd602c53c3653a3d6eb 状态:已下载更新的centos 映像:7
Then I am able to go inside the container.然后我就可以进入容器了。
Setting up proxies and DNS settings were of no use in my case.在我的情况下,设置代理和 DNS 设置没有用。
After extensive research for a couple of days, I was able to overcome the issue using below steps in docker-toolbox bash:经过几天的广泛研究,我能够在 docker-toolbox bash 中使用以下步骤克服这个问题:
$ docker-machine stop default
$ docker-machine rm default
$ docker-machine create --driver virtualbox default
Verify if the machine is runnning.验证机器是否正在运行。 ACTIVE attribute should be marked *:
$ docker-machine ls
ACTIVE属性应标记为 *:
$ docker-machine ls
If the machine is not running, run the machine: $ docker-machine run default
如果机器没有运行,运行机器:
$ docker-machine run default
Then, run hello-world, you will get below screen in your bash然后,运行 hello-world,您将在 bash 中看到以下屏幕
Hope it help you guys and save your time!希望它可以帮助你们并节省您的时间!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.