Search code examples
dockernexus3

Docker pull/push using private registry without prefixing


We are using Nexus3 docker groups (combining dockerhub proxy and private registry) aka:

docker pull dockerproxy:5002/busybox

trying to pull from dockerhub if it does not exist in private registry, push storing in private registry part. Works fine.

But how can I make:

docker pull busybox

go to this registry without having to prefix dockerproxy:5002 first?

An environment variable?, $HOME/.docker/config.json? Creative tagging?

Thanks


Solution

  • Docker support mirrors of docker.io hub https://docs.docker.com/registry/recipes/mirror/:

    edit /etc/docker/daemon.json and add the registry-mirrors key and value, to make the change persistent.

    { "registry-mirrors": ["https://dockerproxy:5002"] }

    Save the file and reload Docker for the change to take effect.

    Now docker pull busybox from your nexus proxy.