Search code examples
dockerdocker-registry

docker private registry within local network


I've set up a private registry for docker, everything works greate from outside (i've a server with several VMs, one of these is the reposiotry).

From my pc I can do docker login -u USER -p PASS repo.mydomain.com and it works great.

Now, from inside another VMs if i do the same i get back Error response from daemon: Get https://repo.mydomain.com/v1/users/: dial tcp 10.236.8.111:443: getsockopt: connection refused

It seems that the repo.mydomain.com is resolved at the local (intramachine) IP, and then the repository hangsup or does not allow the connection to pass by. Or other reasons which I don't know now.

How can I make it working?


Solution

  • So, the workaround is to use it as insecure docker repository, since intercomunication is within the local network. to do so:

    • edit /etc/docker/daemon.json adding { "insecure-registries":["repo.mydomain.com:5000"] }
    • restart docker service docker restart
    • do the login using the port 5000 docker login -u USER -p PASS repo.mydomain.com:5000

    now it says login successfully. Wondering if there's a better (cleaner) way to do it.

    PS: to pull the data you have to use repo.mydomain.com:5000/image