
我在主機上使用私人 docker 註冊表,foo
其中包含以下內容docker-compose.yml
:
version: '3.2'
services:
registry:
restart: unless-stopped
image: registry:2
ports:
- 5000:5000
volumes:
- /tmp/myregistry:/var/lib/registry
我在主機上新增了foo
文件/etc/docker/daemon.json
{
"insecure-registries" : [ "localhost:5000" ]
}
並docker info
顯示:
Insecure Registries:
localhost:5000
127.0.0.0/8
(我真的不知道第二個條目來自哪裡。)
但打電話docker pull localhost:5000/myapp
不行。它只是什麼都不做並且永遠不會返回。同樣,當我打電話時curl -kv http://localhost:5000/v2/
...
(root@foo)/etc/docker# curl -kv http://localhost:5000/v2/
* Trying 127.0.0.1:5000...
* Connected to localhost (127.0.0.1) port 5000 (#0)
> GET /v2/ HTTP/1.1
> Host: localhost:5000
> User-Agent: curl/7.74.0
> Accept: */*
>
使用我的 vpn (openvpn),我可以存取該主機上的私人 docker-repository 並推送應用程式(或執行其他任何操作)。
(thomas@otherhost)~# curl -i http://foo:5000/v2/
HTTP/1.1 200 OK
Content-Length: 2
Content-Type: application/json; charset=utf-8
Docker-Distribution-Api-Version: registry/2.0
X-Content-Type-Options: nosniff
Date: Tue, 14 Jun 2022 22:02:04 GMT
我可以排除防火牆問題。有任何想法嗎?蒂亞!
PS:幾週前,這工作正常,我不知道發生了什麼變化......:(
答案1
不是docker的問題,而是防火牆的問題。