Search code examples
dockerdocker-registry

How to add private registry to docker query list?


I migrated docker daemon from v1.9.1 to v1.11.2 on CentOS 7. Unfortunately, I couldn't add my private registry to docker query list in v1.11.2. Here is my comparison about the two versions.

For Docker daemon V1.9.1:

# docker daemon --help | grep registry

  --add-registry=[]                    Registry to query before a public one
  --block-registry=[]                  Don't contact given registry
  --confirm-def-push=true              Confirm a push to default registry
  --disable-legacy-registry=false      Do not contact legacy registries
  --insecure-registry=[]               Enable insecure registry communication
  --registry-mirror=[]                 Preferred Docker registry mirror

For Docker daemon V1.11.2:

# docker daemon --help  | grep registry
  --disable-legacy-registry            Do not contact legacy registries
  --insecure-registry=[]               Enable insecure registry communication
  --registry-mirror=[]                 Preferred Docker registry mirror

Based on the above comparison, "--add-registry" was removed in V1.11.2. I searched the release notes of v1.10.x and v1.11.x (https://github.com/docker/docker/tags) and hadn't find any comments about the change. Does anyone know why and how to add my private registry to docker query list in v1.11.x? So I could search or pull my private image by "docker pull myimagename:tag"(Not need to specify the URL of private registry).


Solution

  • The --add-registry option was an experimental addition from RedHat to their branch of Docker and not part of the official 1.9 cli.

    To pull an image from a specific registry, simply add the registry name to the beginning of the image name you're pulling.

    And to send all request through your own registry first, configure your registry as a pull through mirror.