docker / buildx

Docker CLI plugin for extended build capabilities with BuildKit
Apache License 2.0
3.53k stars 475 forks source link

Documentation: How to add a windows build to a multiarch linux manifest? #171

Closed scyto closed 4 years ago

scyto commented 4 years ago

Using windows docker desktop I created a multiarch linux builds/manifest with buildx and pushed to docker hub.

I switched mode to windows container and created a windows variant using docker build (i can't get buildx to work for windows?)

I now want to add the windows machine to the linunx manifest that got pushed, i have looked at buildx imagetools docs and docker manifest docs and i can't figure it out.

Would it be possible to provide an example in the docs? I assume it this https://docs.docker.com/engine/reference/commandline/buildx_imagetools_create/

tonistiigi commented 4 years ago

buildx imagetools create -t user/image:multi user/image:linux user/image:windows. You can try with --dry-run to confirm before pushing.

scyto commented 4 years ago

@tonistiigi thanks, I slightly amended (i don't have local images as they are removed after the buildx --push) good tip on testing with --dry-run.

docker buildx imagetools create -t user/image:multi user/image:multi user/image:windows

this seems to use the existing multi manifest, append the windows and then save it. Closing

tonistiigi commented 4 years ago

You can also do docker buildx imagetools create --append -t user/image:multi user/image:window for that case

scyto commented 4 years ago

@tonistiigi i tried that on the first dry run, but the output gave me pause for concern as the output implied to me only windows would be in the resulting manifest - maybe the two versions of the command should show the resulting net output, not the result of just the net input?

docker buildx imagetools create -t user/image:multi user/image:windows

PS C:\Users\lx_b> docker buildx imagetools create --dry-run -t scyto/nodelink:dev-latest scyto/nodelink:dev-latest.windows
{
   "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
   "schemaVersion": 2,
   "manifests": [
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "digest": "sha256:6f552130278a9af82eea24937cdc5a6260a9ab19027fa99316b78fc78843be2d",
         "size": 3232,
         "platform": {
            "architecture": "amd64",
            "os": "windows"
         }
      }
   ]
}

docker buildx imagetools create -t user/image:multi user/image:multi user/image:windows

PS C:\Users\lx_b> docker buildx imagetools create --dry-run -t scyto/nodelink:dev-latest scyto/nodelink:dev-latest scyto/nodelink:dev-latest.windows
{
   "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
   "schemaVersion": 2,
   "manifests": [
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "digest": "sha256:96f01624cb46761a75c47e0e3df6d7e9f28746d33579f3b8e1ecbdbfa4ec4d31",
         "size": 1584,
         "platform": {
            "architecture": "amd64",
            "os": "linux"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "digest": "sha256:f362c4ceaa61af4eb0765b8dbfc99e11408b1e43768249d975b179451ba2c7c5",
         "size": 1584,
         "platform": {
            "architecture": "arm64",
            "os": "linux"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "digest": "sha256:e27041ddb33e856bbd806a89acd9ab880683f4e3d4e3746f938dee53698d47fb",
         "size": 1584,
         "platform": {
            "architecture": "arm",
            "os": "linux",
            "variant": "v7"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "digest": "sha256:6f552130278a9af82eea24937cdc5a6260a9ab19027fa99316b78fc78843be2d",
         "size": 3232,
         "platform": {
            "architecture": "amd64",
            "os": "windows"
         }
      }
   ]
}
scyto commented 4 years ago

oh i see my mistake, the difference is the --append. sorry ignore me :-)