连接在推送Docker映像时被拒绝 [英] Connection refused on pushing a docker image
问题描述
我将通过遵循 https://docs.docker.com/来设置本地注册表注册表/部署/ 。
docker run -d -p 5000:5000 --restart=always --name reg ubuntu:16.04
当我尝试运行以下命令时:
When I try to run the following command:
$ docker push localhost:5000/my-ubuntu
我得到错误:
Get http://localhost:5000/v2/: dial tcp 127.0.0.1:5000: connect:connection refused
有什么想法吗?
推荐答案
连接被拒绝通常意味着您要连接的服务实际上并未像应有的那样正常运行。 此问题中概述的其他原因,但就您的情况而言,从本质上讲,这仅意味着注册表尚未启动。
Connection refused usually means that the service you are trying to connect to isn't actually up and running like it should. There could be other reasons as outlined in this question, but essentially, for your case, it simply means that the registry is not up yet.
请等待执行其他操作之前正确创建注册表容器- docker run -d -p 5000:5000 --restart = always --name注册表注册表:2
从官方docker映像。
Wait for the registry container to be created properly before you do anything else - docker run -d -p 5000:5000 --restart=always --name registry registry:2
that creates a local registry from the official docker image.
请确保 registry
容器通过运行 docker ps |启动。 grep登录
,然后继续进行操作。
Make sure that the registry
container is up by running docker ps | grep registry
, and then proceed further.
这篇关于连接在推送Docker映像时被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!