Mirroring an Image
How to mirror an image to a local docker repository
docker-mirror
is a simple tool to mirror docker images between repositories, usually
from the public docker hub to a local internal repository.
You would do this if you use an image frequently.
For example I mirror the golang:alpine
as I run a lot of builds using golang to compile
multiple projects, so it makes sense to have a local mirror of that image.
This has multiple benefits:
Because this utility uses the docker manifest command you need to enable experimental features to the Docker CLI.
You also need to be logged in to the destination repository when running the tool with an account that allows you to push to that repository.
In most instances you can do exactly the same thing with the following 3 docker commands:
1docker pull golang:alpine
2docker tag library/golang:alpine docker.example.com/library/golang:alpine
3docker push docker.example.com/library/golang:alpine
However this works only for images built for the same architecture as the machine running those commands.
If you have a muti-architecture environment, or need to support multiple architectures like amd64 & arm then this is where docker-mirror becomes useful as it will automatically mirror all architectures an image supports.
Yes it does, however it doesn't work due to a bug with docker #30880 causes it to fail for non-root users.
The source for this tool is on github at https://github.com/peter-mount/docker-mirror.
How to mirror an image to a local docker repository
How to use a mirrored image
How to use docker-mirror in a Jenkins pipeline