dockermultiarch

re-tagging multi-arch docker image


I'm looking for a way to re-tag existing image under different name (for example we release version x.y.z and we would like to tag is as latests as well). Currently I would do:

docker pull docker/my-app:123
docker tag docker/my-app:123 docker/my-app:latest
docker push docker/my-app:latest

It works just fine with regular images but it breaks with multi-arch images and only architecture of my current machine is tagged/pushed. I'm aware that I could add latest tag to buildx (it allows multiple --tag parameters) but we also have case where we have nightly build and for (test) deployment purposes we tag them with more static tag (with date most of the time) and in this case buildx multiple tag approach breaks.

(I know there are several similar questions but they as about tagging images and pushing to different repositories, and quite often github.com/regclient/regclient is suggested as solution)


Solution

  • You can use the buildx imagetools create command. A sample command would look like below:

    docker buildx imagetools create -t docker/my-app:latest docker/my-app:123