Reputation: 313
I'm trying to achieve re tagging of docker images via docker command.
Basically I need to do the below steps to achieve my goal:
1)Pull an existing multi architecture image from private registry.
2)Tag it with new name (e.g: tag imagename-test to imagename-final)
3)And push the newly tagged image back to private registry again.
So I have tried the below command:
docker buildx build --tag {registry name/repository}/imagename-test --tag {registry name/repository}/imagename-final \
-- pull -- platform=linux/amd64,linux/arm64 \
-- push .
Here the image is getting pushed with both tags.But I need to tag imagename-test to imagename-final and only need to push imagename-final to the registry.
Usually we do,
docker pull imagename-test
docker tag imagename-test imagename-final
docker push imagename-final
Any suggestions to achieve this by using only docker buildx commands for multi architecture images?
Upvotes: 6
Views: 4283
Reputation: 263469
In addition to docker buildx imagetools create
, there are multiple tools that would do this without needing to pull the image or risk changing the digest on the image. Google has crane, RedHat has skopeo, and I have regclient.
crane copy $src $dest
skopeo copy docker://$src docker://$dest
regctl image copy $src $dest
With each of those, the tooling only needs to pull the top level manifest, which is typically a couple kb of JSON data, and none of the layers, making it much faster than a docker pull. (You can often download these tools faster than you can pull an image.)
Upvotes: 3