Wednesday, August 21, 2019

[Docker] Troubleshooting to docker private registry

I create a private docker registry as follows and sometimes it cannot reply the http request.
$ sudo docker run -p 7443:7443 --restart=always \
  -v /raid/registry2:/var/lib/registry \
  -e REGISTRY_HTTP_ADDR=0.0.0.0:7443 \
  --name registry registry:2

$ curl -v http://192.168.10.10:7443/v2/_catalog
*   Trying 192.168.10.10...
* TCP_NODELAY set
* Connected to 192.168.10.10 (192.168.10.10) port 7443 (#0)
> GET /v2/_catalog HTTP/1.1
> Host: 192.168.0.109:7443
> User-Agent: curl/7.58.0
> Accept: */*
...(hang)...

Here are the commands that I did for troubleshooting to docker private registry
$ sudo iptables -t nat -L -n -v| less

$ sudo ps aux | grep registry
ubuntu  45407  0.0  0.0  20076  1088 pts/1    S+   11:29   0:00 grep --color=auto registry
root     56382  0.1  0.0 124816 19740 ?        Ssl  11:20   0:00 registry serve /etc/docker/registry/config.yml

$ sudo docker exec -it 038 ps
PID   USER     TIME  COMMAND
    1 root      0:00 registry serve /etc/docker/registry/config.yml
   68 root      0:00 ps

$ sudo docker ps
CONTAINER ID        IMAGE                          COMMAND                  CREATED             STATUS              PORTS               NAMES
038b669bcb90        registry:2                     "/entrypoint.sh /etc…"   6 minutes ago       Up 6 minutes                            registry

$ sudo lsof -i :7443
COMMAND    PID USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME
registry 56382 root    3u  IPv6 119650861      0t0  TCP *:7443 (LISTEN)

$ sudo docker exec -it 038 lsof -i 7443
1       /bin/registry   /dev/null
1       /bin/registry   pipe:[119658134]
1       /bin/registry   pipe:[119658135]
1       /bin/registry   socket:[119650861]
1       /bin/registry   anon_inode:[eventpoll]

$ sudo docker exec -it 038 lsof -i 5000
1       /bin/registry   /dev/null
1       /bin/registry   pipe:[119658134]
1       /bin/registry   pipe:[119658135]
1       /bin/registry   socket:[119650861]
1       /bin/registry   anon_inode:[eventpoll]

Due to not seeing anything wrong, so I change the private registry for using host network and it works.
$ sudo docker run -d --net=host --restart=always \
  -v /raid/registry2:/var/lib/registry \
  -e REGISTRY_HTTP_ADDR=0.0.0.0:7443 \
  --name registry registry:2






No comments: