Skip to content

multiple tags using -t --tag not working #799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
eliorm32 opened this issue Oct 13, 2021 · 5 comments · Fixed by #815
Closed

multiple tags using -t --tag not working #799

eliorm32 opened this issue Oct 13, 2021 · 5 comments · Fixed by #815

Comments

@eliorm32
Copy link

eliorm32 commented Oct 13, 2021

Hey,
using github.com/docker/buildx v0.6.3 266c0ea
can't seem to multiple tag a buildx build. i must result to either using --amend. or getting manifest digests from inspecting the manifest and creating a new one using digests.

i have a build farm with a amd64 instance and arm64.

the command is:
docker buildx build --pull \
--label GIT_REVISION={git_rev} \
--platform {platforms} \
--tag {image_tag} \
-f {path_to_base_docker_file} \
--push {path_to_temp_folder} \
--tag {latest_tag_string}

the command doesn't fail but endpoint/repo:v1 is there on dockerhub but endpoint/repo:latest is not.

regards, Lior.

@tonistiigi
Copy link
Member

What driver are you using when you see this?

@eliorm32
Copy link
Author

eliorm32 commented Oct 15, 2021

first i tried the native driver that was installed with docker. then stumbled upon this #459 (comment) stating to try moby/buildkit:v0.8.0 and it still didn't work. its strange because logs report on manifest creation and merge and states both tags. still for some reason only one tag is showing.

this was my workaround in the mean while:

  1. i rest api to dockerhub to delete the latest tag
  2. then use this method multi platform with multi tags, buildx error #459 (comment).
  3. when i push the manifest associated with the latest tag i use --purge so it deletes the local manifest created else it just keeps adding digests to the current tag on dockerhub probably because it stores manifests locally.

this helped immensely understanding what exactly is going under the hood:
https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/
perhaps this can give you insight regarding the solution.

@tonistiigi
Copy link
Member

Are you using two nodes like #459 ? #459 seems to be an error but there is no comments about what the error is about.

The default case of this seems to work fine so there is something special about your conditions.

 # docker buildx build -t tonistiigi/test:a1 -t tonistiigi/test:a2 --push .
[+] Building 4.0s (8/8) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                  0.1s
 => => transferring dockerfile: 49B                                                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/alpine:latest                                                                                      2.2s
 => [auth] library/alpine:pull token for registry-1.docker.io                                                                                         0.0s
 => CACHED [1/1] FROM docker.io/library/alpine@sha256:e1c082e3d3c45cccac829840a25941e679c25d438cc8412c2fa221cf1a824e6a                                0.0s
 => => resolve docker.io/library/alpine@sha256:e1c082e3d3c45cccac829840a25941e679c25d438cc8412c2fa221cf1a824e6a                                       0.0s
 => exporting to image                                                                                                                                1.6s
 => => exporting layers                                                                                                                               0.0s
 => => exporting manifest sha256:9c7da0f5d0f331d8f61d125c302a07d5eecfd89a346e2f5a119b8befc994d425                                                     0.0s
 => => exporting config sha256:45683da4f97c23d92b878d2ad15eb66e94c9cab368e54797bcd4a4b20c915815                                                       0.0s
 => => pushing layers                                                                                                                                 0.2s
 => => pushing manifest for docker.io/tonistiigi/test:a1@sha256:9c7da0f5d0f331d8f61d125c302a07d5eecfd89a346e2f5a119b8befc994d425                      0.4s
 => => pushing manifest for docker.io/tonistiigi/test:a2@sha256:9c7da0f5d0f331d8f61d125c302a07d5eecfd89a346e2f5a119b8befc994d425                      0.3s
 => [auth] tonistiigi/test:pull,push token for registry-1.docker.io                                                                                   0.0s
 => [auth] tonistiigi/test:pull,push token for registry-1.docker.io                                                                                   0.0s
 # docker buildx imagetools inspect tonistiigi/test:a1
{
   "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
   "schemaVersion": 2,
   "config": {
      "mediaType": "application/vnd.docker.container.image.v1+json",
      "digest": "sha256:45683da4f97c23d92b878d2ad15eb66e94c9cab368e54797bcd4a4b20c915815",
      "size": 600
   },
   "layers": [
      {
         "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
         "digest": "sha256:a0d0a0d46f8b52473982a3c466318f479767577551a53ffc9074c9fa7035982e",
         "size": 2814446
      }
   ]
}
 # docker buildx imagetools inspect tonistiigi/test:a2
{
   "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
   "schemaVersion": 2,
   "config": {
      "mediaType": "application/vnd.docker.container.image.v1+json",
      "digest": "sha256:45683da4f97c23d92b878d2ad15eb66e94c9cab368e54797bcd4a4b20c915815",
      "size": 600
   },
   "layers": [
      {
         "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
         "digest": "sha256:a0d0a0d46f8b52473982a3c466318f479767577551a53ffc9074c9fa7035982e",
         "size": 2814446
      }
   ]
}

@eliorm32
Copy link
Author

yes i am using two separate nodes the main docker daemon is arm and the second docker daemon is amd64
using moby/buildkit:v0.8.0 as driver:

NAME/NODE    DRIVER/ENDPOINT             STATUS  PLATFORMS
farm         docker-container                    
  farm0      unix:///var/run/docker.sock running linux/arm64, linux/arm/v7, linux/arm/v6
  farm1      ssh://[email protected]     running linux/amd64, linux/386
mybuilder *  docker-container                    
  mybuilder0 unix:///var/run/docker.sock running linux/arm64, linux/arm/v7, linux/arm/v6
  mybuilder1 ssh://[email protected]     running linux/amd64, linux/386
default      docker                              
  default    default                     running linux/arm64, linux/arm/v7, linux/arm/v6

it says that it is merging the digests to a manifest but perhaps it is failing to associate the manifest to both the tags and it is associating to only one of them?

@justinTM
Copy link

having this issue as well. neither -t nor --tag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants