从主机连接时,没有来自专用Docker注册表容器的HTTP响应
我正在尝试使用位于以下位置的官方图像创建本地可访问的Docker私有注册表: 我使用的是Debian 10(Buster)VPS。 我遵照官方指示: 已使用以下命令启动容器:从主机连接时,没有来自专用Docker注册表容器的HTTP响应,docker,networking,docker-registry,Docker,Networking,Docker Registry,我正在尝试使用位于以下位置的官方图像创建本地可访问的Docker私有注册表: 我使用的是Debian 10(Buster)VPS。 我遵照官方指示: 已使用以下命令启动容器: docker run-d-p 5000:5000--restart=always--name注册表:2 尝试标记和推送图像: docker-pull ubuntu:16.04 docker标签ubuntu:16.04本地主机:5000/my ubuntu docker push localhost:5000/我的ub
docker run-d-p 5000:5000--restart=always--name注册表:2
尝试标记和推送图像:
docker-pull ubuntu:16.04
docker标签ubuntu:16.04本地主机:5000/my ubuntu
docker push localhost:5000/我的ubuntu
最后一个命令出现以下错误:
Get http://localhost:5000/v2/: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
我确实无法使用curl从注册表接收HTTP响应。注册表似乎在几秒钟后关闭了连接。然而,这种联系确实发生了
me@my-vps:~$ curl -v http://127.0.0.1:5000/v2
* Expire in 0 ms for 6 (transfer 0x5602a82d8fb0)
* Trying 127.0.0.1...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x5602a82d8fb0)
* Connected to 127.0.0.1 (127.0.0.1) port 5000 (#0)
> GET /v2 HTTP/1.1
> Host: 127.0.0.1:5000
> User-Agent: curl/7.64.0
> Accept: */*
>
* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer
注册表容器的端口似乎已正确绑定:
me@my-vps:~$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e09e106fa953 registry:2 "/entrypoint.sh /etc…" 5 minutes ago Up 5 minutes 0.0.0.0:5000->5000/tcp, :::5000->5000/tcp registry
最奇怪的是,当我尝试使用VPS的域或IP地址从另一台机器访问注册表时,一切都正常
PS C:\Users\Me> curl http://my-vps-domain:5000/v2
StatusCode : 200
StatusDescription : OK
Content : {}
RawContent : HTTP/1.1 200 OK
Docker-Distribution-Api-Version: registry/2.0
X-Content-Type-Options: nosniff
Content-Length: 2
Content-Type: application/json; charset=utf-8
Date: Tue, 20 Apr 2021 15:17:58 GMT
...
Forms : {}
Headers : {[Docker-Distribution-Api-Version, registry/2.0], [X-Content-Type-Options, nosniff],
[Content-Length, 2], [Content-Type, application/json; charset=utf-8]...}
Images : {}
InputFields : {}
Links : {}
ParsedHtml : mshtml.HTMLDocumentClass
RawContentLength : 2
到目前为止,我所尝试的:
me@my-vps:~$ sudo docker exec -it registry /bin/sh
/ # netstat -paunt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 :::5000 :::* LISTEN 1/registry
在我看来,这个问题似乎与网络有关。但我不知道如何修复它
多谢各位
me@my-vps:~$ sudo docker exec -it registry /bin/sh
/ # netstat -paunt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 :::5000 :::* LISTEN 1/registry