Mirroring an Image

How to mirror an image to a local docker repository

To mirror an image simply run the command

1docker-mirror -d docker.example.com golang:alpine

Where docker.example.com is the url to your local repository and golang:alpine is the image you want to mirror.

Once complete your mirror of the image can be retrieved with the tag docker.example.com/library/golang:alpine

Note about libraries

In the above example the golang:alpine image is pushed as library/golang:alpine. This is because in docker the source image is in the library project, so if an image does not contain a project then it gets the library project inserted during the pull.

If you pulled from a different project then you would get a path you would expect.

For example, mirroring area51/example:latest would mirror it as docker.example.com/area51/example:latest

Flowchart of mirror process
Flow chart showing what docker-mirror does to perform the mirror

Last modified October 28, 2021: Use proper highlighting (42d84ca)