Republish Docker Image with Digest to Registry

Viewed 28

I pull images from public registries such as DockerHub, and push them to a singular private registry. This is a simple process for images in the format of image:tag but not so for image@digest:.

I don't care about rebuilding the image digest. I only want to re-publish (or push, in docker terms) it from a public registry into a private registry.

image:tag push

docker login -u usr -p psw my-registry.io
docker image pull centos:centos7
docker image push my-registry.io/centos/centos7
...
ok

image@digest: push

docker login -u usr -p psw my-registry.io
docker image pull centos:centos7@sha256:8faead07bd1d5fdd17414a1759eae004da5daa9575a846f4730f44dec0f47843
docker image push my-registry.io/centos/centos7@sha256:8faead07bd1d5fdd17414a1759eae004da5daa9575a846f4730f44dec0f47843
...
cannot push a digest reference

Is this possible? I'm not talking about rebuilding or modifying the image. I just want to make the image available from a private registry instead of its public source.

1 Answers

What you want to do is rename the image and then push it. When you push an image to a repository you are pushing it to the repository specified by the image name. So first rename (changing the tag really) to include the registry you want to push to, then do the push.

docker image pull centos:centos7
docker tag centos:centos7 my-registry.io/centos7:centos7
docker push my-registry.io/centos/centos7
Related