diff --git a/29/cli/Dockerfile b/29/cli/Dockerfile index c6151e0d8..81590688f 100644 --- a/29/cli/Dockerfile +++ b/29/cli/Dockerfile @@ -30,32 +30,32 @@ RUN set -eux; \ apkArch="$(apk --print-arch)"; \ case "$apkArch" in \ 'x86_64') \ - url='https://download.docker.com/linux/static/stable/x86_64/docker-29.10.1.tgz'; \ - sha256='061642059fa7f2ed9b2f04a327a951cff4249585cf04b2661c2a6539197c9962'; \ + url='https://download.docker.com/linux/static/stable/x86_64/docker-cli_29.10.1.tgz'; \ + sha256='27f08878ebbe062e4cf32f2b7c14f7a40b0fb93b92570fcd750c75de77a2fcaa'; \ ;; \ 'armhf') \ - url='https://download.docker.com/linux/static/stable/armel/docker-29.10.1.tgz'; \ - sha256='0a5d05059d3d82099a35ec7326120f4789f43b1b238ecc318242b178b986f09c'; \ + url='https://download.docker.com/linux/static/stable/armel/docker-cli_29.10.1.tgz'; \ + sha256='14fa0513f407ac7ea3a1eb7d6a9ad88f07f8a64e26665490ad75913bae9fcee3'; \ ;; \ 'armv7') \ - url='https://download.docker.com/linux/static/stable/armhf/docker-29.10.1.tgz'; \ - sha256='64e904668b30def335d933d5318b6310927a90a68570073d81741af78e71b1fd'; \ + url='https://download.docker.com/linux/static/stable/armhf/docker-cli_29.10.1.tgz'; \ + sha256='0c2e7e9e264f740d59895617bd539bd6e17b29a9e94e847921571cc609e13fab'; \ ;; \ 'aarch64') \ - url='https://download.docker.com/linux/static/stable/aarch64/docker-29.10.1.tgz'; \ - sha256='a38c8a9ef6d17bce07499bfd3a3688542274769dc3b4f75c06ea2705fe65053e'; \ + url='https://download.docker.com/linux/static/stable/aarch64/docker-cli_29.10.1.tgz'; \ + sha256='866fd254309313bf714eb8116f8ea058ada51401d2d183e7670b00bef2f2d941'; \ ;; \ 'ppc64le') \ - url='https://download.docker.com/linux/static/stable/ppc64le/docker-29.10.1.tgz'; \ - sha256='431f36bea426544239e95019e85a1d491b1b4817fd393fc5258fb2f000577791'; \ + url='https://download.docker.com/linux/static/stable/ppc64le/docker-cli_29.10.1.tgz'; \ + sha256='c7b3761fb9b799e034071547f8ef976f0b70690c10a51835f1b9d4a696a499d5'; \ ;; \ 'riscv64') \ - url='https://download.docker.com/linux/static/stable/riscv64/docker-29.10.1.tgz'; \ - sha256='f30e9d9f642feaf4bc175d8c114f4b0bd4fa0032f2352ffbc1d3269592b9c6bf'; \ + url='https://download.docker.com/linux/static/stable/riscv64/docker-cli_29.10.1.tgz'; \ + sha256='19c956d1330598ef980c4e9d4065890e61d3c7154b801679792be8a37171f3ef'; \ ;; \ 's390x') \ - url='https://download.docker.com/linux/static/stable/s390x/docker-29.10.1.tgz'; \ - sha256='c161754580a9e74a8af85a78b9ee7c79a5971676c28113b88f117cafd8036728'; \ + url='https://download.docker.com/linux/static/stable/s390x/docker-cli_29.10.1.tgz'; \ + sha256='34f35ed000bf32125ff6ed6e62e2fe48f3f459da35fdd65f8a4e48a144521574'; \ ;; \ *) echo >&2 "error: unsupported 'docker.tgz' architecture ($apkArch)"; exit 1 ;; \ esac; \ @@ -68,7 +68,7 @@ RUN set -eux; \ --strip-components 1 \ --directory /usr/local/bin/ \ --no-same-owner \ - 'docker/docker' \ + 'bin/docker' \ ; \ rm docker.tgz; \ \ diff --git a/29/dind-rootless/Dockerfile b/29/dind-rootless/Dockerfile index 4ba4222e2..084e33fe4 100644 --- a/29/dind-rootless/Dockerfile +++ b/29/dind-rootless/Dockerfile @@ -29,14 +29,35 @@ RUN set -eux; \ url='https://download.docker.com/linux/static/stable/x86_64/docker-rootless-extras-29.10.1.tgz'; \ sha256='11eb5fa9a88e5971e71713aa277dbd916b7d368c6625844cacffa1c42b8df60c'; \ ;; \ + 'armhf') \ + url='https://download.docker.com/linux/static/stable/armel/docker-rootless-extras-29.10.1.tgz'; \ + sha256='976e508d9a256322921948933798732c7b2eca875dcd8182678468b57572be0a'; \ + ;; \ + 'armv7') \ + url='https://download.docker.com/linux/static/stable/armhf/docker-rootless-extras-29.10.1.tgz'; \ + sha256='be4c104a5b99b568671bdf29be129fcb23a08f9f0c7e3fcacd311a4593cfbff7'; \ + ;; \ 'aarch64') \ url='https://download.docker.com/linux/static/stable/aarch64/docker-rootless-extras-29.10.1.tgz'; \ sha256='9b677eb3bb0ce21c4e6aae3e44678309250f1aa6fbc95f66a94de7b88b04e45b'; \ ;; \ + 'ppc64le') \ + url='https://download.docker.com/linux/static/stable/ppc64le/docker-rootless-extras-29.10.1.tgz'; \ + sha256='725aeeb0858684127197ca8bb5fc2a8132f1adb4a2597dd9502fd954d39a5ed0'; \ + ;; \ + 'riscv64') \ + url='https://download.docker.com/linux/static/stable/riscv64/docker-rootless-extras-29.10.1.tgz'; \ + sha256='8e7aa270a82cdf4ae7b96f3672053cf65617da2a575e636d0e51d03a846fe0c2'; \ + ;; \ + 's390x') \ + url='https://download.docker.com/linux/static/stable/s390x/docker-rootless-extras-29.10.1.tgz'; \ + sha256='2e39dfd4130d0eb6b2cc3935672e557aca9cea354f3ffc96a186ecb5c4786771'; \ + ;; \ *) echo >&2 "error: unsupported 'rootless.tgz' architecture ($apkArch)"; exit 1 ;; \ esac; \ \ wget -O 'rootless.tgz' "$url"; \ + echo "$sha256 *"'rootless.tgz' | sha256sum -c -; \ \ tar --extract \ --file rootless.tgz \ diff --git a/29/dind/Dockerfile b/29/dind/Dockerfile index c49f98288..c0e9726a5 100644 --- a/29/dind/Dockerfile +++ b/29/dind/Dockerfile @@ -56,32 +56,32 @@ RUN set -eux; \ apkArch="$(apk --print-arch)"; \ case "$apkArch" in \ 'x86_64') \ - url='https://download.docker.com/linux/static/stable/x86_64/docker-29.10.1.tgz'; \ - sha256='061642059fa7f2ed9b2f04a327a951cff4249585cf04b2661c2a6539197c9962'; \ + url='https://download.docker.com/linux/static/stable/x86_64/docker-engine_29.10.1.tgz'; \ + sha256='c530efff9498c33227043061563e390739bd4cee626a958357ea0abc0d53a2a0'; \ ;; \ 'armhf') \ - url='https://download.docker.com/linux/static/stable/armel/docker-29.10.1.tgz'; \ - sha256='0a5d05059d3d82099a35ec7326120f4789f43b1b238ecc318242b178b986f09c'; \ + url='https://download.docker.com/linux/static/stable/armel/docker-engine_29.10.1.tgz'; \ + sha256='5d399af1c9f3f29ea4765c44b888bb7bbda9f254e8bf2230fa628e65a40f3e8c'; \ ;; \ 'armv7') \ - url='https://download.docker.com/linux/static/stable/armhf/docker-29.10.1.tgz'; \ - sha256='64e904668b30def335d933d5318b6310927a90a68570073d81741af78e71b1fd'; \ + url='https://download.docker.com/linux/static/stable/armhf/docker-engine_29.10.1.tgz'; \ + sha256='55105b9e8da700112ed93f40199d58862f5376c85344cbeab0622b8c124a8756'; \ ;; \ 'aarch64') \ - url='https://download.docker.com/linux/static/stable/aarch64/docker-29.10.1.tgz'; \ - sha256='a38c8a9ef6d17bce07499bfd3a3688542274769dc3b4f75c06ea2705fe65053e'; \ + url='https://download.docker.com/linux/static/stable/aarch64/docker-engine_29.10.1.tgz'; \ + sha256='7fbc252bfacb3685d244dfbef701048de7640eb981f24033623f0a3af4fc48b5'; \ ;; \ 'ppc64le') \ - url='https://download.docker.com/linux/static/stable/ppc64le/docker-29.10.1.tgz'; \ - sha256='431f36bea426544239e95019e85a1d491b1b4817fd393fc5258fb2f000577791'; \ + url='https://download.docker.com/linux/static/stable/ppc64le/docker-engine_29.10.1.tgz'; \ + sha256='755c3d51f4377d9269f72198293f34e4ca8a58af7716085426c4f50c85d88fc1'; \ ;; \ 'riscv64') \ - url='https://download.docker.com/linux/static/stable/riscv64/docker-29.10.1.tgz'; \ - sha256='f30e9d9f642feaf4bc175d8c114f4b0bd4fa0032f2352ffbc1d3269592b9c6bf'; \ + url='https://download.docker.com/linux/static/stable/riscv64/docker-engine_29.10.1.tgz'; \ + sha256='09161e18d14c1cfea30e15f56a5535ebf0eef29fd641c8d70017ba21ad7ee873'; \ ;; \ 's390x') \ - url='https://download.docker.com/linux/static/stable/s390x/docker-29.10.1.tgz'; \ - sha256='c161754580a9e74a8af85a78b9ee7c79a5971676c28113b88f117cafd8036728'; \ + url='https://download.docker.com/linux/static/stable/s390x/docker-engine_29.10.1.tgz'; \ + sha256='ff4e6aa4f1c513862667d52facea19da235b0704404d5a52dee27059e49ecc73'; \ ;; \ *) echo >&2 "error: unsupported 'docker.tgz' architecture ($apkArch)"; exit 1 ;; \ esac; \ @@ -94,15 +94,96 @@ RUN set -eux; \ --strip-components 1 \ --directory /usr/local/bin/ \ --no-same-owner \ -# we exclude the CLI binary because we already extracted that over in the "docker:29-cli" image that we're FROM and we don't want to duplicate those bytes again in this layer - --exclude 'docker/docker' \ -# exclude containerd, relying on the "embedded containerd" instead: https://github.com/moby/moby/pull/53388 (makes for a smaller image) - --exclude 'docker/containerd' \ +# only "bin" (not the "doc" directory with a README and LICENSE we do not want in /usr/local/bin) + 'bin' \ ; \ rm docker.tgz; \ \ - dockerd --version; \ - ctr --version; \ + dockerd --version + +# the "embedded containerd" means we only need the shim and "ctr" from containerd (not the whole daemon): https://github.com/moby/moby/pull/53388 (makes for a smaller image) +RUN set -eux; \ + \ + apkArch="$(apk --print-arch)"; \ + case "$apkArch" in \ + 'x86_64') \ + url='https://github.com/containerd/containerd/releases/download/v2.4.2/containerd-static-2.4.2-linux-amd64.tar.gz'; \ + sha256='da656542e754c699a0f438eab925e6ffdbd6346a4428e659f83dc058f04dcffe'; \ + ;; \ + 'aarch64') \ + url='https://github.com/containerd/containerd/releases/download/v2.4.2/containerd-static-2.4.2-linux-arm64.tar.gz'; \ + sha256='37b84b9534533672528141b9d815f58621a2fe5deee2daa84317800255756689'; \ + ;; \ + 'ppc64le') \ + url='https://github.com/containerd/containerd/releases/download/v2.4.2/containerd-static-2.4.2-linux-ppc64le.tar.gz'; \ + sha256='62e789018b9684b15c6cc0fa75566da7170b8cc9dc4655a91b637d8ec58e451a'; \ + ;; \ + 'riscv64') \ + url='https://github.com/containerd/containerd/releases/download/v2.4.2/containerd-static-2.4.2-linux-riscv64.tar.gz'; \ + sha256='9cc5ff951d351e7c9166486f7805be4e5ec1e9442113987700ba5218a18d205c'; \ + ;; \ + 's390x') \ + url='https://github.com/containerd/containerd/releases/download/v2.4.2/containerd-static-2.4.2-linux-s390x.tar.gz'; \ + sha256='cf4b70a6e74cacd6b06d909f7d16217f8ed10bffe32191197f3232e51c49fe86'; \ + ;; \ + *) echo >&2 "error: unsupported 'containerd.tgz' architecture ($apkArch)"; exit 1 ;; \ + esac; \ + \ + wget -O 'containerd.tgz' "$url"; \ + echo "$sha256 *"'containerd.tgz' | sha256sum -c -; \ + \ + tar --extract \ + --file containerd.tgz \ + --strip-components 1 \ + --directory /usr/local/bin/ \ + --no-same-owner \ + 'bin/containerd-shim-runc-v2' \ + 'bin/ctr' \ + ; \ + rm containerd.tgz; \ + \ + ctr --version + +RUN set -eux; \ + \ + apkArch="$(apk --print-arch)"; \ + case "$apkArch" in \ + 'x86_64') \ + url='https://github.com/opencontainers/runc/releases/download/v1.5.3/runc.amd64'; \ + sha256='50dcc0b257d724fe07f3852c2dda52340223f038227c7572644eec870741223e'; \ + ;; \ + 'armhf') \ + url='https://github.com/opencontainers/runc/releases/download/v1.5.3/runc.armel'; \ + sha256='339e33a5ee914e902b938e8fdc3487110f240dd82f23fadefa53c169c2982d06'; \ + ;; \ + 'armv7') \ + url='https://github.com/opencontainers/runc/releases/download/v1.5.3/runc.armhf'; \ + sha256='411d8039888d71a167e6125f5bef2aef71f2ab80769c507cbeb7f51ba54f6392'; \ + ;; \ + 'aarch64') \ + url='https://github.com/opencontainers/runc/releases/download/v1.5.3/runc.arm64'; \ + sha256='07b52aee923cc432c38fe4fb6809a08fc6471994efed650af3635350588a20be'; \ + ;; \ + 'ppc64le') \ + url='https://github.com/opencontainers/runc/releases/download/v1.5.3/runc.ppc64le'; \ + sha256='e773f7c88e536edfbd690ce3aa4efb192beaeabeeaedf8dd4400aff91a97c028'; \ + ;; \ + 'riscv64') \ + url='https://github.com/opencontainers/runc/releases/download/v1.5.3/runc.riscv64'; \ + sha256='780dd7e9e269d94c759c8578ef030b18c8d22fc4a43b8209465d5e485015f9bb'; \ + ;; \ + 's390x') \ + url='https://github.com/opencontainers/runc/releases/download/v1.5.3/runc.s390x'; \ + sha256='159738a9e973b5c74aa9dec39845c36809d9dbf61fd2bc859f6a455436c17976'; \ + ;; \ + *) echo >&2 "error: unsupported 'runc' architecture ($apkArch)"; exit 1 ;; \ + esac; \ + \ + wget -O 'runc' "$url"; \ + echo "$sha256 *"'runc' | sha256sum -c -; \ + \ + chmod +x runc; \ + mv -vT runc /usr/local/bin/runc; \ runc --version # https://github.com/moby/moby/tree/master/hack/dind diff --git a/29/windows/windowsservercore-ltsc2022/Dockerfile b/29/windows/windowsservercore-ltsc2022/Dockerfile index 6a2d13e2b..9b29aca89 100644 --- a/29/windows/windowsservercore-ltsc2022/Dockerfile +++ b/29/windows/windowsservercore-ltsc2022/Dockerfile @@ -10,14 +10,14 @@ FROM mcr.microsoft.com/windows/servercore:ltsc2022 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] # PATH isn't actually set in the Docker image, so we have to set it from within the container -RUN $newPath = ('{0}\docker;{1}' -f $env:ProgramFiles, $env:PATH); \ +RUN $newPath = ('{0}\Docker\bin;{1}' -f $env:ProgramFiles, $env:PATH); \ Write-Host ('Updating PATH: {0}' -f $newPath); \ [Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine); # doing this first to share cache across versions more aggressively ENV DOCKER_VERSION 29.10.1 -ENV DOCKER_URL https://download.docker.com/win/static/stable/x86_64/docker-29.10.1.zip -ENV DOCKER_SHA256 cda7ca0c5d7f7373ffbeec50d811de64c22efc43d2cbd10a2e4c95fdea3f4a09 +ENV DOCKER_URL https://download.docker.com/win/static/stable/x86_64/docker-cli_29.10.1.zip +ENV DOCKER_SHA256 0a9434db59f31b58853e9620c54f11488fcec8d2527d223a9d8dbb2273c74c44 RUN Write-Host ('Downloading {0} ...' -f $env:DOCKER_URL); \ Invoke-WebRequest -Uri $env:DOCKER_URL -OutFile 'docker.zip'; \ @@ -29,14 +29,11 @@ RUN Write-Host ('Downloading {0} ...' -f $env:DOCKER_URL); \ }; \ \ Write-Host 'Expanding ...'; \ - Expand-Archive docker.zip -DestinationPath $env:ProgramFiles; \ -# (this archive has a "docker/..." directory in it already) + Expand-Archive docker.zip -DestinationPath ('{0}\Docker' -f $env:ProgramFiles); \ +# (this archive has "bin/docker.exe" in it, hence the "bin" directory we added to PATH above -- the "cli-plugins" directory below goes right next to it, which is where the CLI looks for plugins) \ Write-Host 'Removing ...'; \ - Remove-Item @( \ - 'docker.zip', \ - ('{0}\docker\dockerd.exe' -f $env:ProgramFiles) \ - ) -Force; \ + Remove-Item 'docker.zip' -Force; \ \ Write-Host 'Verifying install ("docker --version") ...'; \ docker --version; \ @@ -47,7 +44,7 @@ RUN Write-Host ('Downloading {0} ...' -f $env:DOCKER_URL); \ ENV DOCKER_BUILDX_VERSION 0.39.1 ENV DOCKER_BUILDX_URL https://github.com/docker/buildx/releases/download/v0.39.1/buildx-v0.39.1.windows-amd64.exe ENV DOCKER_BUILDX_SHA256 4a665d2c71f6f87a42313cb8847b8e834e2dfb1626a1b57fcdbaacf41a6c8387 -RUN $dir = ('{0}\docker\cli-plugins' -f $env:ProgramFiles); \ +RUN $dir = ('{0}\Docker\cli-plugins' -f $env:ProgramFiles); \ Write-Host ('Creating {0} ...' -f $dir); \ New-Item -ItemType Directory $dir -Force; \ \ @@ -68,7 +65,7 @@ RUN $dir = ('{0}\docker\cli-plugins' -f $env:ProgramFiles); \ ENV DOCKER_COMPOSE_VERSION 5.8.0 ENV DOCKER_COMPOSE_URL https://github.com/docker/compose/releases/download/v5.8.0/docker-compose-windows-x86_64.exe ENV DOCKER_COMPOSE_SHA256 0c2d9245a5f61e8e3cc85009b8b4888fa82fded08239d28bd6da5ca818eda2b2 -RUN $dir = ('{0}\docker\cli-plugins' -f $env:ProgramFiles); \ +RUN $dir = ('{0}\Docker\cli-plugins' -f $env:ProgramFiles); \ Write-Host ('Creating {0} ...' -f $dir); \ New-Item -ItemType Directory $dir -Force; \ \ @@ -85,7 +82,7 @@ RUN $dir = ('{0}\docker\cli-plugins' -f $env:ProgramFiles); \ Write-Host 'Verifying install ("docker compose version") ...'; \ docker compose version; \ \ - $link = ('{0}\docker\docker-compose.exe' -f $env:ProgramFiles); \ + $link = ('{0}\Docker\bin\docker-compose.exe' -f $env:ProgramFiles); \ Write-Host ('Linking {0} to {1} ...' -f $plugin, $link); \ New-Item -ItemType SymbolicLink -Path $link -Target $plugin; \ \ diff --git a/29/windows/windowsservercore-ltsc2025/Dockerfile b/29/windows/windowsservercore-ltsc2025/Dockerfile index 6ebb1ab22..2a0d6f44d 100644 --- a/29/windows/windowsservercore-ltsc2025/Dockerfile +++ b/29/windows/windowsservercore-ltsc2025/Dockerfile @@ -10,14 +10,14 @@ FROM mcr.microsoft.com/windows/servercore:ltsc2025 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] # PATH isn't actually set in the Docker image, so we have to set it from within the container -RUN $newPath = ('{0}\docker;{1}' -f $env:ProgramFiles, $env:PATH); \ +RUN $newPath = ('{0}\Docker\bin;{1}' -f $env:ProgramFiles, $env:PATH); \ Write-Host ('Updating PATH: {0}' -f $newPath); \ [Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine); # doing this first to share cache across versions more aggressively ENV DOCKER_VERSION 29.10.1 -ENV DOCKER_URL https://download.docker.com/win/static/stable/x86_64/docker-29.10.1.zip -ENV DOCKER_SHA256 cda7ca0c5d7f7373ffbeec50d811de64c22efc43d2cbd10a2e4c95fdea3f4a09 +ENV DOCKER_URL https://download.docker.com/win/static/stable/x86_64/docker-cli_29.10.1.zip +ENV DOCKER_SHA256 0a9434db59f31b58853e9620c54f11488fcec8d2527d223a9d8dbb2273c74c44 RUN Write-Host ('Downloading {0} ...' -f $env:DOCKER_URL); \ Invoke-WebRequest -Uri $env:DOCKER_URL -OutFile 'docker.zip'; \ @@ -29,14 +29,11 @@ RUN Write-Host ('Downloading {0} ...' -f $env:DOCKER_URL); \ }; \ \ Write-Host 'Expanding ...'; \ - Expand-Archive docker.zip -DestinationPath $env:ProgramFiles; \ -# (this archive has a "docker/..." directory in it already) + Expand-Archive docker.zip -DestinationPath ('{0}\Docker' -f $env:ProgramFiles); \ +# (this archive has "bin/docker.exe" in it, hence the "bin" directory we added to PATH above -- the "cli-plugins" directory below goes right next to it, which is where the CLI looks for plugins) \ Write-Host 'Removing ...'; \ - Remove-Item @( \ - 'docker.zip', \ - ('{0}\docker\dockerd.exe' -f $env:ProgramFiles) \ - ) -Force; \ + Remove-Item 'docker.zip' -Force; \ \ Write-Host 'Verifying install ("docker --version") ...'; \ docker --version; \ @@ -47,7 +44,7 @@ RUN Write-Host ('Downloading {0} ...' -f $env:DOCKER_URL); \ ENV DOCKER_BUILDX_VERSION 0.39.1 ENV DOCKER_BUILDX_URL https://github.com/docker/buildx/releases/download/v0.39.1/buildx-v0.39.1.windows-amd64.exe ENV DOCKER_BUILDX_SHA256 4a665d2c71f6f87a42313cb8847b8e834e2dfb1626a1b57fcdbaacf41a6c8387 -RUN $dir = ('{0}\docker\cli-plugins' -f $env:ProgramFiles); \ +RUN $dir = ('{0}\Docker\cli-plugins' -f $env:ProgramFiles); \ Write-Host ('Creating {0} ...' -f $dir); \ New-Item -ItemType Directory $dir -Force; \ \ @@ -68,7 +65,7 @@ RUN $dir = ('{0}\docker\cli-plugins' -f $env:ProgramFiles); \ ENV DOCKER_COMPOSE_VERSION 5.8.0 ENV DOCKER_COMPOSE_URL https://github.com/docker/compose/releases/download/v5.8.0/docker-compose-windows-x86_64.exe ENV DOCKER_COMPOSE_SHA256 0c2d9245a5f61e8e3cc85009b8b4888fa82fded08239d28bd6da5ca818eda2b2 -RUN $dir = ('{0}\docker\cli-plugins' -f $env:ProgramFiles); \ +RUN $dir = ('{0}\Docker\cli-plugins' -f $env:ProgramFiles); \ Write-Host ('Creating {0} ...' -f $dir); \ New-Item -ItemType Directory $dir -Force; \ \ @@ -85,7 +82,7 @@ RUN $dir = ('{0}\docker\cli-plugins' -f $env:ProgramFiles); \ Write-Host 'Verifying install ("docker compose version") ...'; \ docker compose version; \ \ - $link = ('{0}\docker\docker-compose.exe' -f $env:ProgramFiles); \ + $link = ('{0}\Docker\bin\docker-compose.exe' -f $env:ProgramFiles); \ Write-Host ('Linking {0} to {1} ...' -f $plugin, $link); \ New-Item -ItemType SymbolicLink -Path $link -Target $plugin; \ \ diff --git a/Dockerfile-cli.template b/Dockerfile-cli.template index 273ddf5af..d493f5dc0 100644 --- a/Dockerfile-cli.template +++ b/Dockerfile-cli.template @@ -25,8 +25,8 @@ RUN set -eux; \ {{ download({ arches: .arches, - urlKey: "dockerUrl", - sha256Key: "dockerSha256", + urlKey: "cliUrl", + sha256Key: "cliSha256", target: "docker.tgz", }) }}; \ @@ -36,7 +36,7 @@ RUN set -eux; \ --strip-components 1 \ --directory /usr/local/bin/ \ --no-same-owner \ - 'docker/docker' \ + 'bin/docker' \ ; \ rm docker.tgz; \ \ diff --git a/Dockerfile-dind.template b/Dockerfile-dind.template index 3c9459358..a934296f7 100644 --- a/Dockerfile-dind.template +++ b/Dockerfile-dind.template @@ -51,8 +51,8 @@ RUN set -eux; \ {{ download({ arches: .arches, - urlKey: "dockerUrl", - sha256Key: "dockerSha256", + urlKey: "engineUrl", + sha256Key: "engineSha256", target: "docker.tgz", }) }}; \ @@ -62,20 +62,50 @@ RUN set -eux; \ --strip-components 1 \ --directory /usr/local/bin/ \ --no-same-owner \ -# we exclude the CLI binary because we already extracted that over in the "docker:{{ env.version }}-cli" image that we're FROM and we don't want to duplicate those bytes again in this layer - --exclude 'docker/docker' \ -{{ if .version == "29.8.2" then "" else ( -}} -# exclude containerd, relying on the "embedded containerd" instead: https://github.com/moby/moby/pull/53388 (makes for a smaller image) - --exclude 'docker/containerd' \ -{{ ) end -}} +# only "bin" (not the "doc" directory with a README and LICENSE we do not want in /usr/local/bin) + 'bin' \ ; \ rm docker.tgz; \ \ - dockerd --version; \ -{{ if .version == "29.8.2" then ( -}} - containerd --version; \ -{{ ) else "" end -}} - ctr --version; \ + dockerd --version + +# the "embedded containerd" means we only need the shim and "ctr" from containerd (not the whole daemon): https://github.com/moby/moby/pull/53388 (makes for a smaller image) +RUN set -eux; \ + \ + {{ + download({ + arches: .containerd.arches, + urlKey: "url", + sha256Key: "sha256", + target: "containerd.tgz", + }) + }}; \ + \ + tar --extract \ + --file containerd.tgz \ + --strip-components 1 \ + --directory /usr/local/bin/ \ + --no-same-owner \ + 'bin/containerd-shim-runc-v2' \ + 'bin/ctr' \ + ; \ + rm containerd.tgz; \ + \ + ctr --version + +RUN set -eux; \ + \ + {{ + download({ + arches: .runc.arches, + urlKey: "url", + sha256Key: "sha256", + target: "runc", + }) + }}; \ + \ + chmod +x runc; \ + mv -vT runc /usr/local/bin/runc; \ runc --version # https://github.com/moby/moby/tree/master/hack/dind diff --git a/Dockerfile-windows-servercore.template b/Dockerfile-windows-servercore.template index d7969968d..814aefd1d 100644 --- a/Dockerfile-windows-servercore.template +++ b/Dockerfile-windows-servercore.template @@ -4,42 +4,30 @@ FROM mcr.microsoft.com/windows/{{ env.windowsVariant }}:{{ env.windowsRelease }} SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] # PATH isn't actually set in the Docker image, so we have to set it from within the container -RUN $newPath = ('{0}\docker;{1}' -f $env:ProgramFiles, $env:PATH); \ +RUN $newPath = ('{0}\Docker\bin;{1}' -f $env:ProgramFiles, $env:PATH); \ Write-Host ('Updating PATH: {0}' -f $newPath); \ [Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine); # doing this first to share cache across versions more aggressively ENV DOCKER_VERSION {{ .version }} -ENV DOCKER_URL {{ .arches["windows-amd64"].dockerUrl }} -{{ if .arches["windows-amd64"].dockerSha256 then ( -}} -ENV DOCKER_SHA256 {{ .arches["windows-amd64"].dockerSha256 }} -{{ ) else ( -}} -{{ # TODO remove this whole else block! as of 29.10.0-rc.1, we have checksums 🥳 -}} -# TODO ENV DOCKER_SHA256 -# https://github.com/docker/docker-ce/blob/5b073ee2cf564edee5adca05eee574142f7627bb/components/packaging/static/hash_files !! -# (no SHA file artifacts on download.docker.com yet as of 2017-06-07 though) -{{ ) end -}} +ENV DOCKER_URL {{ .arches["windows-amd64"].cliUrl }} +ENV DOCKER_SHA256 {{ .arches["windows-amd64"].cliSha256 }} RUN Write-Host ('Downloading {0} ...' -f $env:DOCKER_URL); \ Invoke-WebRequest -Uri $env:DOCKER_URL -OutFile 'docker.zip'; \ \ -{{ if .arches["windows-amd64"].dockerSha256 then ( -}} Write-Host ('Verifying sha256 ({0}) ...' -f $env:DOCKER_SHA256); \ if ((Get-FileHash docker.zip -Algorithm sha256).Hash -ne $env:DOCKER_SHA256) { \ Write-Host 'FAILED!'; \ exit 1; \ }; \ \ -{{ ) else "" end -}} Write-Host 'Expanding ...'; \ - Expand-Archive docker.zip -DestinationPath $env:ProgramFiles; \ -# (this archive has a "docker/..." directory in it already) + Expand-Archive docker.zip -DestinationPath ('{0}\Docker' -f $env:ProgramFiles); \ +# (this archive has "bin/docker.exe" in it, hence the "bin" directory we added to PATH above -- the "cli-plugins" directory below goes right next to it, which is where the CLI looks for plugins) \ Write-Host 'Removing ...'; \ - Remove-Item @( \ - 'docker.zip', \ - ('{0}\docker\dockerd.exe' -f $env:ProgramFiles) \ - ) -Force; \ + Remove-Item 'docker.zip' -Force; \ \ Write-Host 'Verifying install ("docker --version") ...'; \ docker --version; \ @@ -58,7 +46,7 @@ RUN Write-Host ('Downloading {0} ...' -f $env:DOCKER_URL); \ ENV DOCKER_{{ $KEY }}_VERSION {{ .version }} ENV DOCKER_{{ $KEY }}_URL {{ .arches["windows-amd64"].url }} ENV DOCKER_{{ $KEY }}_SHA256 {{ .arches["windows-amd64"].sha256 }} -RUN $dir = ('{0}\docker\cli-plugins' -f $env:ProgramFiles); \ +RUN $dir = ('{0}\Docker\cli-plugins' -f $env:ProgramFiles); \ Write-Host ('Creating {0} ...' -f $dir); \ New-Item -ItemType Directory $dir -Force; \ \ @@ -76,7 +64,7 @@ RUN $dir = ('{0}\docker\cli-plugins' -f $env:ProgramFiles); \ docker {{ $key }} version; \ {{ if $key == "compose" then ( -}} \ - $link = ('{0}\docker\docker-{{ $key }}.exe' -f $env:ProgramFiles); \ + $link = ('{0}\Docker\bin\docker-{{ $key }}.exe' -f $env:ProgramFiles); \ Write-Host ('Linking {0} to {1} ...' -f $plugin, $link); \ New-Item -ItemType SymbolicLink -Path $link -Target $plugin; \ \ diff --git a/generate-stackbrew-library.jq b/generate-stackbrew-library.jq new file mode 100644 index 000000000..05e814eb9 --- /dev/null +++ b/generate-stackbrew-library.jq @@ -0,0 +1,140 @@ +# emits the given version followed by each of its less specific parents, stopping at $stop ("29.10.0" with a $stop of "29" emits "29.10.0", "29.10", "29") +def version_chain($stop): + ., + ( + select(. != $stop and test("[.-]")) + | sub("[.-][^.-]*$"; "") + | version_chain($stop) + ) +; + +# whether the given architecture of the given version has everything the given variant needs +def arch_supported($version; $arch; $name): + $version.arches[$arch] as $files + | $files.cliUrl + and ( + if $name | startswith("dind") then + $files.engineUrl + # "dockerd" embeds containerd, but we still need the shim and "ctr" (and "runc"), which come from their own releases + and $version.containerd.arches[$arch] + and $version.runc.arches[$arch] + and ($name != "dind-rootless" or $files.rootlessExtrasUrl) + else true end + ) +; + +map_values(select(.)) # ignore nulls ("29-rc" post-GA) +| to_entries +# sort version numbers with highest first +| sort_by(.key | split("[.-]"; "") | map(try tonumber // .)) +| reverse +| . as $entries + +# our entries are in precedence order, so loop over them in order and assign "generic" aliases like "29" and "latest" to the first entry that might use them +| ( + reduce .[] as $e ({ taken: {}, aliases: {} }; + $e.key as $key + | ($key | rtrimstr("-rc")) as $rcVersion + | $e.value.version as $fullVersion + | ( + if $key == $rcVersion then + [ $fullVersion | version_chain($key) ] as $chain + | $chain[:-1] + [ $key | select(. != $chain[-1]) ] # "29.10.0", "29.10" + else + [ $fullVersion, ($key | select(. != $fullVersion)) ] # "29.10.0-rc.2", "29-rc" + end + ) as $aliases + | .taken as $taken + | [ + if $key == $rcVersion then + ($key | split(".")[0]), # "29" + "latest" + else "rc" end + | select($taken[.] | not) + ] as $extra + | .taken += ($extra | map({ (.): $key }) | add // {}) + | .aliases[$key] = $aliases + $extra + ) + | .aliases +) as $versionAliases + +| $entries[] +| .key as $key +| .value as $version + +# only the versions asked for "./generate-stackbrew-library.sh X Y ..." +| select($ARGS.positional == [] or IN($key; $ARGS.positional[])) + +| $versionAliases[$key] as $aliases +| ($parents[$key] | sub("^[^:]*:"; "")) as $alpine # "3.24" + +| $version.variants[] as $variant # "cli", "windows/windowsservercore-ltsc2025", etc +| ($variant | split("/")[-1]) as $name # "cli", "windowsservercore-ltsc2025", etc + +# skip variants that do not have a Dockerfile +| $commits["\($key)/\($variant)"] as $commit +| select($commit) + +# Tags: +| ( + $aliases + | map(if . == "latest" then $name else "\(.)-\($name)" end) +) as $variantAliases +| [ + $variantAliases[], + if $name | IN("cli", "dind") then + "\($variantAliases[0])-alpine\($alpine)", + if $name == "dind" then + # dind is our "default" variant, so it gets the plain version tags too + $aliases[], + "\($aliases[0])-alpine\($alpine)", + empty + else empty end, + empty + else empty end, + empty +] as $tags + +# SharedTags: +| [ + if $name | startswith("windowsservercore") then + $aliases[] + | if . == "latest" then + "windowsservercore" + else "\(.)-windowsservercore" end + else empty end +] as $sharedTags + +# Architectures: +| ( + $version.arches + | keys + | map(select(arch_supported($version; .; $name))) + | if $variant | startswith("windows/") then + map(select(startswith("windows-"))) + else + . - ( + . - ( + $parentsArches[$parents[$key]] + // error("no architectures found for parent image: \($parents[$key])") + ) + ) # intersection + end +) as $arches + +| ( + "", + "Tags: \($tags | join(", "))", + if $sharedTags != [] then + "SharedTags: \($sharedTags | join(", "))" + else empty end, + "Architectures: \($arches | join(", "))", + "GitCommit: \($commit)", + "Directory: \($key)/\($variant)", + if $variant != $name then + "Constraints: \($name)", + "Builder: classic", # no Windows support in BuildKit (yet) + empty + else empty end, + empty +) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 920da3058..1ca606832 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -4,18 +4,6 @@ set -Eeuo pipefail self="$(basename "$BASH_SOURCE")" cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" -if [ "$#" -eq 0 ]; then - versions="$(jq -r ' - to_entries - # sort version numbers with highest first - | sort_by(.key | split("[.-]"; "") | map(try tonumber // .)) - | reverse - | map(if .value then .key | @sh else empty end) - | join(" ") - ' versions.json)" - eval "set -- $versions" -fi - # get the most recent commit which modified any of "$@" fileCommit() { git log -1 --format='format:%H' HEAD -- "$@" @@ -38,55 +26,45 @@ dirCommit() { ) } -getArches() { - local repo="$1"; shift - local officialImagesBase="${BASHBREW_LIBRARY:-https://github.com/docker-library/official-images/raw/HEAD/library}/" - - local parentRepoToArchesStr - parentRepoToArchesStr="$( - find -name 'Dockerfile' -exec awk -v officialImagesBase="$officialImagesBase" ' - toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|.*\/.*)(:|$)/ { - printf "%s%s\n", officialImagesBase, $2 - } - ' '{}' + \ - | sort -u \ - | xargs -r bashbrew cat --format '["{{ .RepoName }}:{{ .TagName }}"]="{{ join " " .TagEntry.Architectures }}"' - )" - eval "declare -g -A parentRepoToArches=( $parentRepoToArchesStr )" -} -getArches 'docker' - -versionArches() { - local version="$1"; shift - local variant="${1:-}" - local selector='dockerUrl' - if [[ "$variant" = *rootless ]]; then - selector='rootlessExtrasUrl' - fi - - if [[ "$variant" = windows/* ]]; then - version="$version" jq -r ' - .[env.version].arches - | keys[] - | select(startswith("windows-")) - ' versions.json | sort - return +# "29/cli", "29/windows/windowsservercore-ltsc2025", etc +dirs="$( + jq --raw-output ' + to_entries[] + | select(.value) + | .key as $version + | .value.variants[] + | "\($version)/\(.)" + | @sh + ' versions.json +)" +eval "dirs=( $dirs )" + +commits='{}' +parents='{}' +for dir in "${dirs[@]}"; do + [ -f "$dir/Dockerfile" ] || continue + + commit="$(dirCommit "$dir")" + commits="$(jq <<<"$commits" --compact-output --arg dir "$dir" --arg commit "$commit" '.[$dir] = $commit')" + + # only "cli" is FROM our base image (the other variants are FROM it), so that is where we find out which parent image's architectures limit us + version="${dir%%/*}" + if [ "${dir#*/}" = 'cli' ]; then + parent="$(jq --raw-input --null-input --raw-output 'first(inputs | capture("^FROM (?[^ ]+)"; "i").parent)' "$dir/Dockerfile")" + [ -n "$parent" ] + parents="$(jq <<<"$parents" --compact-output --arg version "$version" --arg parent "$parent" '.[$version] = $parent')" fi +done - local parent parentArches - parent="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/cli/Dockerfile")" - parentArches="${parentRepoToArches[$parent]:-}" +getArches() { + local oiBase="${BASHBREW_LIBRARY:-https://github.com/docker-library/official-images/raw/HEAD/library}/" - comm -12 \ - <( - version="$version" jq -r --arg selector "$selector" ' - .[env.version].arches | to_entries[] - | select(.value[$selector]) - | .key - ' versions.json | sort - ) \ - <(xargs -n1 <<<"$parentArches" | sort) + # grab supported architectures for each parent image + jq <<<"$parents" --raw-output --arg oiBase "$oiBase" '[ .[] ] | unique[] | $oiBase + .' \ + | xargs -r bashbrew cat --format '{ {{ join ":" .RepoName .TagName | json }}: {{ json .TagEntry.Architectures }} }' \ + | jq --compact-output --slurp 'add // {}' } +parentsArches="$(getArches)" cat <<-EOH # this file is generated via https://github.com/docker-library/docker/blob/$(fileCommit "$self")/$self @@ -97,113 +75,11 @@ GitRepo: https://github.com/docker-library/docker.git Builder: buildkit EOH -# prints "$2$1$3$1...$N" -join() { - local sep="$1"; shift - local out; printf -v out "${sep//%/%%}%s" "$@" - echo "${out#$sep}" -} - -# used for auto-detecting the "latest" of each channel (for tagging it appropriately) -# https://blog.docker.com/2017/03/docker-enterprise-edition/ -declare -A latestChannelRelease=() - -for version; do - export version - rcVersion="${version%-rc}" - - if ! fullVersion="$(jq -er '.[env.version] | if . then .version else empty end' versions.json)"; then - # support running "generate-stackbrew-library.sh" on a singular "null" version ("20.10-rc" when the RC is older than the GA release, for example) - continue - fi - - versionAliases=() - if [ "$version" = "$rcVersion" ]; then - while [ "$fullVersion" != "$rcVersion" -a "${fullVersion%[.-]*}" != "$fullVersion" ]; do - versionAliases+=( $fullVersion ) - fullVersion="${fullVersion%[.-]*}" - done - else - versionAliases+=( $fullVersion ) - fi - if [ "$fullVersion" != "$version" ]; then - versionAliases+=( - $version - ) - fi - - # add a few channel/version-related aliases - majorVersion="${version%%.*}" - if [ "$version" != "$rcVersion" ] && [ -z "${latestChannelRelease['rc']:-}" ]; then - versionAliases+=( 'rc' ) - latestChannelRelease['rc']="$version" - fi - if [ "$version" = "$rcVersion" ] && [ -z "${latestChannelRelease[$majorVersion]:-}" ]; then - versionAliases+=( "$majorVersion" ) - latestChannelRelease["$majorVersion"]="$version" - fi - - channel='stable' - if [ "$rcVersion" != "$version" ]; then - channel='test' - fi - # every release goes into the "test" channel, so the biggest numbered release wins (RC or not) - if [ -z "${latestChannelRelease['test']:-}" ]; then - latestChannelRelease['test']="$version" - fi - if [ "$version" = "$rcVersion" ] && [ -z "${latestChannelRelease['latest']:-}" ]; then - versionAliases+=( 'latest' ) - latestChannelRelease['latest']="$version" - fi - - variants="$(jq -r '.[env.version].variants | map(@sh) | join(" ")' versions.json)" - eval "variants=( $variants )" - - for v in "${variants[@]}"; do - dir="$version/$v" - [ -f "$dir/Dockerfile" ] || continue - - commit="$(dirCommit "$dir")" - - variant="$(basename "$v")" - variantAliases=( "${versionAliases[@]/%/-$variant}" ) - variantAliases=( "${variantAliases[@]//latest-/}" ) - - if [ "$variant" = 'cli' ] || [ "$variant" = 'dind' ]; then - parent="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/cli/Dockerfile")" - alpine="${parent#*:}" # "3.14" - suiteAliases=( "${variantAliases[0]}" ) # only "X.Y.Z-foo" - suiteAliases=( "${suiteAliases[@]/%/-alpine$alpine}" ) - suiteAliases=( "${suiteAliases[@]//latest-/}" ) - variantAliases+=( "${suiteAliases[@]}" ) - if [ "$variant" = 'dind' ]; then - # add "latest" aliases - suiteAliases=( "${versionAliases[0]}" ) # only "X.Y.Z-foo" - suiteAliases=( "${suiteAliases[@]/%/-alpine$alpine}" ) - suiteAliases=( "${suiteAliases[@]//latest-/}" ) - variantAliases+=( "${versionAliases[@]}" "${suiteAliases[@]}" ) - fi - fi - - sharedTags=() - if [[ "$variant" == windowsservercore* ]]; then - sharedTags=( "${versionAliases[@]/%/-windowsservercore}" ) - sharedTags=( "${sharedTags[@]//latest-/}" ) - fi - - echo - echo "Tags: $(join ', ' "${variantAliases[@]}")" - if [ "${#sharedTags[@]}" -gt 0 ]; then - echo "SharedTags: $(join ', ' "${sharedTags[@]}")" - fi - cat <<-EOE - Architectures: $(join ', ' $(versionArches "$version" "$v")) - GitCommit: $commit - Directory: $dir - EOE - if [ "$variant" != "$v" ]; then - echo "Constraints: $variant" - echo 'Builder: classic' # no Windows support in BuildKit (yet) - fi - done -done +exec jq \ + --raw-output \ + --argjson commits "$commits" \ + --argjson parents "$parents" \ + --argjson parentsArches "$parentsArches" \ + --from-file generate-stackbrew-library.jq \ + versions.json \ + --args -- "$@" diff --git a/shared.jq b/shared.jq index ed950bbb3..c5326b401 100644 --- a/shared.jq +++ b/shared.jq @@ -39,12 +39,18 @@ def download(opts): | ($bashbrewArch | apkArch) as $apkArch | .value | .[opts.urlKey] as $url - | (if $notSha256 then "none" else .[opts.sha256Key] end) as $sha256 | select($apkArch and $url) + | ( + if $notSha256 then + "none" + else + .[opts.sha256Key] // error("missing \(opts.sha256Key) for \($bashbrewArch)") + end + ) as $sha256 | (" \($apkArch | @sh)) url=\($url | @sh);" - + if $notSha256 or ($sha256 == null) then "" else " + + if $notSha256 then "" else " sha256=\($sha256 | @sh);" end + " ;;" @@ -57,7 +63,7 @@ def download(opts): wget -O \(opts.target | @sh) \"$url\";" , - if opts.sha256Key and all(opts.arches[]; has(opts.sha256Key)) then " + if opts.sha256Key then " echo \"$sha256 *\"\(opts.target | @sh) | sha256sum -c -;" else "" end ] | add diff --git a/versions.json b/versions.json index a9e9edee4..c8872052d 100644 --- a/versions.json +++ b/versions.json @@ -2,40 +2,64 @@ "29": { "arches": { "amd64": { - "dockerSha256": "061642059fa7f2ed9b2f04a327a951cff4249585cf04b2661c2a6539197c9962", - "dockerUrl": "https://download.docker.com/linux/static/stable/x86_64/docker-29.10.1.tgz", + "cliSha256": "27f08878ebbe062e4cf32f2b7c14f7a40b0fb93b92570fcd750c75de77a2fcaa", + "cliUrl": "https://download.docker.com/linux/static/stable/x86_64/docker-cli_29.10.1.tgz", + "engineSha256": "c530efff9498c33227043061563e390739bd4cee626a958357ea0abc0d53a2a0", + "engineUrl": "https://download.docker.com/linux/static/stable/x86_64/docker-engine_29.10.1.tgz", "rootlessExtrasSha256": "11eb5fa9a88e5971e71713aa277dbd916b7d368c6625844cacffa1c42b8df60c", "rootlessExtrasUrl": "https://download.docker.com/linux/static/stable/x86_64/docker-rootless-extras-29.10.1.tgz" }, "arm32v6": { - "dockerSha256": "0a5d05059d3d82099a35ec7326120f4789f43b1b238ecc318242b178b986f09c", - "dockerUrl": "https://download.docker.com/linux/static/stable/armel/docker-29.10.1.tgz" + "cliSha256": "14fa0513f407ac7ea3a1eb7d6a9ad88f07f8a64e26665490ad75913bae9fcee3", + "cliUrl": "https://download.docker.com/linux/static/stable/armel/docker-cli_29.10.1.tgz", + "engineSha256": "5d399af1c9f3f29ea4765c44b888bb7bbda9f254e8bf2230fa628e65a40f3e8c", + "engineUrl": "https://download.docker.com/linux/static/stable/armel/docker-engine_29.10.1.tgz", + "rootlessExtrasSha256": "976e508d9a256322921948933798732c7b2eca875dcd8182678468b57572be0a", + "rootlessExtrasUrl": "https://download.docker.com/linux/static/stable/armel/docker-rootless-extras-29.10.1.tgz" }, "arm32v7": { - "dockerSha256": "64e904668b30def335d933d5318b6310927a90a68570073d81741af78e71b1fd", - "dockerUrl": "https://download.docker.com/linux/static/stable/armhf/docker-29.10.1.tgz" + "cliSha256": "0c2e7e9e264f740d59895617bd539bd6e17b29a9e94e847921571cc609e13fab", + "cliUrl": "https://download.docker.com/linux/static/stable/armhf/docker-cli_29.10.1.tgz", + "engineSha256": "55105b9e8da700112ed93f40199d58862f5376c85344cbeab0622b8c124a8756", + "engineUrl": "https://download.docker.com/linux/static/stable/armhf/docker-engine_29.10.1.tgz", + "rootlessExtrasSha256": "be4c104a5b99b568671bdf29be129fcb23a08f9f0c7e3fcacd311a4593cfbff7", + "rootlessExtrasUrl": "https://download.docker.com/linux/static/stable/armhf/docker-rootless-extras-29.10.1.tgz" }, "arm64v8": { - "dockerSha256": "a38c8a9ef6d17bce07499bfd3a3688542274769dc3b4f75c06ea2705fe65053e", - "dockerUrl": "https://download.docker.com/linux/static/stable/aarch64/docker-29.10.1.tgz", + "cliSha256": "866fd254309313bf714eb8116f8ea058ada51401d2d183e7670b00bef2f2d941", + "cliUrl": "https://download.docker.com/linux/static/stable/aarch64/docker-cli_29.10.1.tgz", + "engineSha256": "7fbc252bfacb3685d244dfbef701048de7640eb981f24033623f0a3af4fc48b5", + "engineUrl": "https://download.docker.com/linux/static/stable/aarch64/docker-engine_29.10.1.tgz", "rootlessExtrasSha256": "9b677eb3bb0ce21c4e6aae3e44678309250f1aa6fbc95f66a94de7b88b04e45b", "rootlessExtrasUrl": "https://download.docker.com/linux/static/stable/aarch64/docker-rootless-extras-29.10.1.tgz" }, "ppc64le": { - "dockerSha256": "431f36bea426544239e95019e85a1d491b1b4817fd393fc5258fb2f000577791", - "dockerUrl": "https://download.docker.com/linux/static/stable/ppc64le/docker-29.10.1.tgz" + "cliSha256": "c7b3761fb9b799e034071547f8ef976f0b70690c10a51835f1b9d4a696a499d5", + "cliUrl": "https://download.docker.com/linux/static/stable/ppc64le/docker-cli_29.10.1.tgz", + "engineSha256": "755c3d51f4377d9269f72198293f34e4ca8a58af7716085426c4f50c85d88fc1", + "engineUrl": "https://download.docker.com/linux/static/stable/ppc64le/docker-engine_29.10.1.tgz", + "rootlessExtrasSha256": "725aeeb0858684127197ca8bb5fc2a8132f1adb4a2597dd9502fd954d39a5ed0", + "rootlessExtrasUrl": "https://download.docker.com/linux/static/stable/ppc64le/docker-rootless-extras-29.10.1.tgz" }, "riscv64": { - "dockerSha256": "f30e9d9f642feaf4bc175d8c114f4b0bd4fa0032f2352ffbc1d3269592b9c6bf", - "dockerUrl": "https://download.docker.com/linux/static/stable/riscv64/docker-29.10.1.tgz" + "cliSha256": "19c956d1330598ef980c4e9d4065890e61d3c7154b801679792be8a37171f3ef", + "cliUrl": "https://download.docker.com/linux/static/stable/riscv64/docker-cli_29.10.1.tgz", + "engineSha256": "09161e18d14c1cfea30e15f56a5535ebf0eef29fd641c8d70017ba21ad7ee873", + "engineUrl": "https://download.docker.com/linux/static/stable/riscv64/docker-engine_29.10.1.tgz", + "rootlessExtrasSha256": "8e7aa270a82cdf4ae7b96f3672053cf65617da2a575e636d0e51d03a846fe0c2", + "rootlessExtrasUrl": "https://download.docker.com/linux/static/stable/riscv64/docker-rootless-extras-29.10.1.tgz" }, "s390x": { - "dockerSha256": "c161754580a9e74a8af85a78b9ee7c79a5971676c28113b88f117cafd8036728", - "dockerUrl": "https://download.docker.com/linux/static/stable/s390x/docker-29.10.1.tgz" + "cliSha256": "34f35ed000bf32125ff6ed6e62e2fe48f3f459da35fdd65f8a4e48a144521574", + "cliUrl": "https://download.docker.com/linux/static/stable/s390x/docker-cli_29.10.1.tgz", + "engineSha256": "ff4e6aa4f1c513862667d52facea19da235b0704404d5a52dee27059e49ecc73", + "engineUrl": "https://download.docker.com/linux/static/stable/s390x/docker-engine_29.10.1.tgz", + "rootlessExtrasSha256": "2e39dfd4130d0eb6b2cc3935672e557aca9cea354f3ffc96a186ecb5c4786771", + "rootlessExtrasUrl": "https://download.docker.com/linux/static/stable/s390x/docker-rootless-extras-29.10.1.tgz" }, "windows-amd64": { - "dockerSha256": "cda7ca0c5d7f7373ffbeec50d811de64c22efc43d2cbd10a2e4c95fdea3f4a09", - "dockerUrl": "https://download.docker.com/win/static/stable/x86_64/docker-29.10.1.zip" + "cliSha256": "0a9434db59f31b58853e9620c54f11488fcec8d2527d223a9d8dbb2273c74c44", + "cliUrl": "https://download.docker.com/win/static/stable/x86_64/docker-cli_29.10.1.zip" } }, "buildx": { @@ -188,7 +212,77 @@ }, "version": "5.8.0" }, + "containerd": { + "arches": { + "amd64": { + "file": "containerd-static-2.4.2-linux-amd64.tar.gz", + "sha256": "da656542e754c699a0f438eab925e6ffdbd6346a4428e659f83dc058f04dcffe", + "url": "https://github.com/containerd/containerd/releases/download/v2.4.2/containerd-static-2.4.2-linux-amd64.tar.gz" + }, + "arm64v8": { + "file": "containerd-static-2.4.2-linux-arm64.tar.gz", + "sha256": "37b84b9534533672528141b9d815f58621a2fe5deee2daa84317800255756689", + "url": "https://github.com/containerd/containerd/releases/download/v2.4.2/containerd-static-2.4.2-linux-arm64.tar.gz" + }, + "ppc64le": { + "file": "containerd-static-2.4.2-linux-ppc64le.tar.gz", + "sha256": "62e789018b9684b15c6cc0fa75566da7170b8cc9dc4655a91b637d8ec58e451a", + "url": "https://github.com/containerd/containerd/releases/download/v2.4.2/containerd-static-2.4.2-linux-ppc64le.tar.gz" + }, + "riscv64": { + "file": "containerd-static-2.4.2-linux-riscv64.tar.gz", + "sha256": "9cc5ff951d351e7c9166486f7805be4e5ec1e9442113987700ba5218a18d205c", + "url": "https://github.com/containerd/containerd/releases/download/v2.4.2/containerd-static-2.4.2-linux-riscv64.tar.gz" + }, + "s390x": { + "file": "containerd-static-2.4.2-linux-s390x.tar.gz", + "sha256": "cf4b70a6e74cacd6b06d909f7d16217f8ed10bffe32191197f3232e51c49fe86", + "url": "https://github.com/containerd/containerd/releases/download/v2.4.2/containerd-static-2.4.2-linux-s390x.tar.gz" + } + }, + "version": "2.4.2" + }, "dindCommit": "8d9e3502aba39127e4d12196dae16d306f76993d", + "runc": { + "arches": { + "amd64": { + "file": "runc.amd64", + "sha256": "50dcc0b257d724fe07f3852c2dda52340223f038227c7572644eec870741223e", + "url": "https://github.com/opencontainers/runc/releases/download/v1.5.3/runc.amd64" + }, + "arm32v6": { + "file": "runc.armel", + "sha256": "339e33a5ee914e902b938e8fdc3487110f240dd82f23fadefa53c169c2982d06", + "url": "https://github.com/opencontainers/runc/releases/download/v1.5.3/runc.armel" + }, + "arm32v7": { + "file": "runc.armhf", + "sha256": "411d8039888d71a167e6125f5bef2aef71f2ab80769c507cbeb7f51ba54f6392", + "url": "https://github.com/opencontainers/runc/releases/download/v1.5.3/runc.armhf" + }, + "arm64v8": { + "file": "runc.arm64", + "sha256": "07b52aee923cc432c38fe4fb6809a08fc6471994efed650af3635350588a20be", + "url": "https://github.com/opencontainers/runc/releases/download/v1.5.3/runc.arm64" + }, + "ppc64le": { + "file": "runc.ppc64le", + "sha256": "e773f7c88e536edfbd690ce3aa4efb192beaeabeeaedf8dd4400aff91a97c028", + "url": "https://github.com/opencontainers/runc/releases/download/v1.5.3/runc.ppc64le" + }, + "riscv64": { + "file": "runc.riscv64", + "sha256": "780dd7e9e269d94c759c8578ef030b18c8d22fc4a43b8209465d5e485015f9bb", + "url": "https://github.com/opencontainers/runc/releases/download/v1.5.3/runc.riscv64" + }, + "s390x": { + "file": "runc.s390x", + "sha256": "159738a9e973b5c74aa9dec39845c36809d9dbf61fd2bc859f6a455436c17976", + "url": "https://github.com/opencontainers/runc/releases/download/v1.5.3/runc.s390x" + } + }, + "version": "1.5.3" + }, "variants": [ "cli", "dind", diff --git a/versions.sh b/versions.sh index 0ef1ea359..7e248b772 100755 --- a/versions.sh +++ b/versions.sh @@ -25,6 +25,11 @@ fi versions=( "${versions[@]%/}" ) scriptPid="$$" # so we can kill the script even from a subshell +fatal() { + echo >&2 "error: $*" + kill "$scriptPid" + exit 1 +} _curl() { exec 42>&1 local code @@ -33,9 +38,135 @@ _curl() { 200) return 0 ;; 404) return 1 ;; esac - echo >&2 "error: unexpected status code $code while fetching: $*" - kill "$scriptPid" - exit 1 + fatal "unexpected status code $code while fetching: $*" +} + +# prints the (numeric) release tags of a GitHub repository, newest first -- optionally limited to a "series" ("2.4" matches "2.4.0", "2.4.1", etc) +githubTags() { + local repo="$1"; shift + local series="${1:-}" + git ls-remote --tags "https://github.com/$repo.git" \ + | jq --raw-input --null-input --raw-output --arg series "$series" ' + [ + inputs + | capture("refs/tags/v(?[0-9.]+)($|\\^)").version + | select($series == "" or startswith($series + ".")) + ] + | unique_by(split(".") | map(tonumber? // .)) + | reverse[] + ' +} + +# prints the contents of the given checksum files (assets) of a GitHub release, or returns non-zero if the release is missing any of them +# (assets are named with "%VERSION%" standing in for the release version, and a leading "?" makes an asset optional) +githubReleaseChecksums() { + local repo="$1"; shift + local version="$1"; shift + local asset optional piece checksums= + for asset; do + optional= + case "$asset" in + '?'*) optional=1; asset="${asset#'?'}" ;; + esac + asset="${asset//%VERSION%/$version}" + if piece="$(_curl "https://github.com/$repo/releases/download/v$version/$asset")"; then + checksums+="$piece"$'\n' + elif [ -z "$optional" ]; then + return 1 + fi + done + printf '%s' "$checksums" +} + +# turns the contents of "sha256sum" files into { version, arches: { bashbrewArch: { sha256, file, url } } } (and insists on both "amd64" and "arm64v8") +# - $repo and $version are the release in question +# - $config.file is a regular expression with an "arch" group (and optionally an "os" group, which defaults to "linux" and prefixes everything else, as in "windows-amd64") matching filenames +# - $config.arches maps the "arch" group to bashbrew architectures +# - $config.skip is a regular expression of files to ignore (which defaults to the "*.json" attestations) +checksumsToArches=' + split("\n") + | map( + # skips blank lines (and PGP armor, for files like runc.sha256sum) + capture("^(?[0-9a-f]{64}) [ *]?(?.+)$") + | select(.file | test($config.skip // "[.]json$") | not) + | .url = "https://github.com/\($repo)/releases/download/v\($version)/\(.file)" + | .file as $file + | { ( + $file + | capture($config.file) + // error("failed to parse os-arch from filename: \($file)") + | if .os == null or .os == "linux" then "" else .os + "-" end + + ($config.arches[.arch] // error("unknown architecture in filename: \($file)")) + ): . } + ) + | add + | if has("amd64") and has("arm64v8") then + . + else + error("missing \(if has("amd64") then "arm64v8" else "amd64" end) in release \($version) of \($repo)") + end + | { version: $version, arches: . } +' + +# usage: githubRelease REPO SERIES CONFIG ASSET [ASSET ...] +# prints the newest release of REPO (in SERIES, if not empty) that has all the checksum ASSET files, as per "checksumsToArches" (see "githubReleaseChecksums" for ASSET and "checksumsToArches" for CONFIG, which is a jq object literal) +githubRelease() { + local repo="$1"; shift + local series="$1"; shift + local config="$1"; shift + + local configJson + configJson="$(jq --null-input --compact-output "$config")" || return "$?" + + local versions + versions="$(githubTags "$repo" "$series")" || return "$?" + + local version checksums + for version in $versions; do + if checksums="$(githubReleaseChecksums "$repo" "$version" "$@")"; then + jq <<<"$checksums" --raw-input --slurp --compact-output --arg repo "$repo" --arg version "$version" --argjson config "$configJson" "$checksumsToArches" + return "$?" + fi + done + fatal "failed to determine $repo${series:+ $series} version!" +} + +# prints { KEYUrl, KEYSha256 } for the given download.docker.com URL, or returns non-zero if it doesn't exist (but a missing or malformed checksum is fatal) +dockerArtifact() { + local key="$1"; shift + local url="$1"; shift + _curl --head "$url" > /dev/null || return 1 + local sha256 + sha256="$(_curl "$url.sha256")" || fatal "missing checksum for $url" + sha256="${sha256%% *}" + if [[ ! "$sha256" =~ ^[[:xdigit:]]{64}$ ]]; then + fatal "invalid checksum for $url: '$sha256'" + fi + # (our caller treats a non-zero exit as "does not exist", so anything else going wrong here has to be fatal instead) + jq --null-input --compact-output --arg key "$key" --arg url "$url" --arg sha256 "$sha256" ' + { + ($key + "Url"): $url, + ($key + "Sha256"): $sha256, + } + ' || fatal "failed to generate JSON for $url" +} + +# prints the "X.Y" series of the given "ARG NAME_VERSION=vX.Y.Z" (from moby's Dockerfile) +mobySeries() { + local dockerfile="$1"; shift + local name="$1"; shift + jq <<<"$dockerfile" --raw-input --null-input --raw-output --arg name "$name" ' + [ + inputs + | capture("^ARG \($name)_VERSION=v(?[0-9]+)[.](?[0-9]+)[.]") + | "\(.major).\(.minor)" + ] + | if length == 1 then + .[0] + else + error("expected exactly one \($name)_VERSION, not \(length)") + end + ' } dindLatest="$( @@ -52,116 +183,39 @@ dockerVersions="$( ' )" -buildxVersions="$( - git ls-remote --tags https://github.com/docker/buildx.git \ - | jq --raw-input --null-input --raw-output ' - [ inputs | capture("refs/tags/v(?[0-9.]+)($|\\^)") | .version ] - | unique_by( split(".") | map(tonumber? // .) ) - | reverse[] - ' +# checksums.txt -> linux + *bsd checksums +# checksums-signed.txt -> windows + darwin checksums (see also https://github.com/docker/buildx/pull/3978) +buildx="$( + githubRelease docker/buildx '' '{ + file: "[.](?linux|windows|darwin|[a-z0-9]*bsd)-(?[^.]+)(?[.]exe)?$", + arches: { + "amd64": "amd64", + "arm-v6": "arm32v6", + "arm-v7": "arm32v7", + "arm64": "arm64v8", + "ppc64le": "ppc64le", + "riscv64": "riscv64", + "s390x": "s390x", + }, + }' checksums.txt checksums-signed.txt )" -buildx= -buildxVersion= -for buildxVersion in $buildxVersions; do - # checksums.txt -> linux + *bsd checksums - # checksums-signed.txt -> windows + darwin checksums (see also https://github.com/docker/buildx/pull/3978) - # fail if one is missing - if \ - checksums="$(_curl "https://github.com/docker/buildx/releases/download/v${buildxVersion}/checksums.txt")" \ - && checksums+=$'\n' \ - && checksums+="$(_curl "https://github.com/docker/buildx/releases/download/v${buildxVersion}/checksums-signed.txt")" \ - ; then - buildx="$(jq <<<"$checksums" -csR --arg version "$buildxVersion" ' - rtrimstr("\n") | split("\n") - | map( - split(" [ *]?"; "") - | { - sha256: .[0], - file: .[1], - url: ("https://github.com/docker/buildx/releases/download/v" + $version + "/" + .[1]), - } - | select(.file | test("[.]json$") | not) - | { ( - .file - | capture("[.](?linux|windows|darwin|[a-z0-9]*bsd)-(?[^.]+)(?[.]exe)?$") - // error("failed to parse os-arch from filename: " + .) - | if .os == "linux" then "" else .os + "-" end - + ({ - "amd64": "amd64", - "arm-v6": "arm32v6", - "arm-v7": "arm32v7", - "arm64": "arm64v8", - "ppc64le": "ppc64le", - "riscv64": "riscv64", - "s390x": "s390x", - }[.arch] // error("unknown buildx architecture: " + .arch)) - ): . } - ) - | add - | { - version: $version, - arches: ., - } - ')" - break - fi -done -if [ -z "$buildx" ]; then - echo >&2 'error: failed to determine buildx version!' - exit 1 -fi +buildxVersion="$(jq <<<"$buildx" --raw-output '.version')" -composeVersions="$( - git ls-remote --tags https://github.com/docker/compose.git \ - | jq --raw-input --null-input --raw-output ' - [ inputs | capture("refs/tags/v(?[0-9.]+)($|\\^)") | .version ] - | unique_by( split(".") | map(tonumber? // .) ) - | reverse[] - ' +compose="$( + githubRelease docker/compose '' '{ + file: "-(?linux|windows|darwin|freebsd|openbsd)-(?[^.]+)(?[.]exe)?$", + arches: { + aarch64: "arm64v8", + armv6: "arm32v6", + armv7: "arm32v7", + ppc64le: "ppc64le", + riscv64: "riscv64", + s390x: "s390x", + x86_64: "amd64", + }, + }' checksums.txt )" -compose= -composeVersion= -for composeVersion in $composeVersions; do - if checksums="$(_curl "https://github.com/docker/compose/releases/download/v${composeVersion}/checksums.txt")"; then - compose="$(jq <<<"$checksums" -csR --arg version "$composeVersion" ' - rtrimstr("\n") | split("\n") - | map( - split(" *") - | { - sha256: .[0], - file: .[1], - url: ("https://github.com/docker/compose/releases/download/v" + $version + "/" + .[1]), - } - | select(.file | test("[.]json$") | not) - | { ( - .file - | capture("-(?linux|windows|darwin|freebsd|openbsd)-(?[^.]+)(?[.]exe)?$") - // error("failed to parse os-arch from filename: " + .) - | if .os == "linux" then "" else .os + "-" end - + ({ - aarch64: "arm64v8", - armv6: "arm32v6", - armv7: "arm32v7", - ppc64le: "ppc64le", - riscv64: "riscv64", - s390x: "s390x", - x86_64: "amd64", - }[.arch] // error("unknown compose architecture: " + .arch)) - ): . } - ) - | add - | { - version: $version, - arches: ., - } - ')" - break - fi -done -if [ -z "$compose" ]; then - echo >&2 'error: failed to determine compose version!' - exit 1 -fi +composeVersion="$(jq <<<"$compose" --raw-output '.version')" for version in "${versions[@]}"; do rcVersion="${version%-rc}" @@ -197,92 +251,131 @@ for version in "${versions[@]}"; do fi fi - echo "$version: $fullVersion (buildx $buildxVersion, compose $composeVersion)" + # the download.docker.com archives no longer include containerd or runc, so we use the "X.Y" series moby pins and go find the latest patch release of each + mobyDockerfile="$(_curl "https://github.com/moby/moby/raw/docker-v$fullVersion/Dockerfile")" || fatal "failed to fetch moby's Dockerfile for $fullVersion" + # (these have to be separate assignments, not "$(...)" arguments to "githubRelease" below, so that a failure here aborts instead of silently becoming an empty series, which would mean "any release") + containerdSeries="$(mobySeries "$mobyDockerfile" 'CONTAINERD')" + runcSeries="$(mobySeries "$mobyDockerfile" 'RUNC')" + + # the (static) containerd tarballs have a "bin/" directory with "containerd", "ctr", the shim, etc in them + containerd="$( + githubRelease containerd/containerd "$containerdSeries" '{ + file: "-(?linux)-(?[^.]+)[.]tar[.]gz$", + arches: { + "amd64": "amd64", + "arm64": "arm64v8", + "ppc64le": "ppc64le", + "riscv64": "riscv64", + "s390x": "s390x", + }, + }' \ + containerd-static-%VERSION%-linux-amd64.tar.gz.sha256sum \ + containerd-static-%VERSION%-linux-arm64.tar.gz.sha256sum \ + ?containerd-static-%VERSION%-linux-ppc64le.tar.gz.sha256sum \ + ?containerd-static-%VERSION%-linux-riscv64.tar.gz.sha256sum \ + ?containerd-static-%VERSION%-linux-s390x.tar.gz.sha256sum + )" + containerdVersion="$(jq <<<"$containerd" --raw-output '.version')" + + # "runc.sha256sum" is PGP-signed + # https://github.com/opencontainers/runc/blob/v1.5.3/script/lib.sh ("armel" is GOARM=5, which runs on our "arm32v6", and "armhf" is GOARM=7, which only runs on "arm32v7") + runc="$( + githubRelease opencontainers/runc "$runcSeries" '{ + file: "^runc[.](?.+)$", + skip: "[.]386$|[.]tar[.]xz$", + arches: { + "amd64": "amd64", + "arm64": "arm64v8", + "armel": "arm32v6", + "armhf": "arm32v7", + "ppc64le": "ppc64le", + "riscv64": "riscv64", + "s390x": "s390x", + }, + }' runc.sha256sum + )" + runcVersion="$(jq <<<"$runc" --raw-output '.version')" + + echo "$version: $fullVersion (containerd $containerdVersion, runc $runcVersion, buildx $buildxVersion, compose $composeVersion)" export fullVersion dindLatest doc="$( - jq -nc --argjson buildx "$buildx" --argjson compose "$compose" '{ + jq --null-input --compact-output --argjson containerd "$containerd" --argjson runc "$runc" --argjson buildx "$buildx" --argjson compose "$compose" '{ version: env.fullVersion, arches: {}, dindCommit: env.dindLatest, + containerd: $containerd, + runc: $runc, buildx: $buildx, compose: $compose, }' )" - declare -A hasArches=() for bashbrewArch in "${!dockerArches[@]}"; do arch="${dockerArches[$bashbrewArch]}" - # check whether the given architecture is supported for this release - case "$bashbrewArch" in - windows-*) url="https://download.docker.com/win/static/$channel/$arch/docker-$fullVersion.zip"; windows=1 ;; - *) url="https://download.docker.com/linux/static/$channel/$arch/docker-$fullVersion.tgz"; windows= ;; - esac - if _curl --head "$url" > /dev/null; then - export bashbrewArch url - doc="$( - jq <<<"$doc" -c '.arches[env.bashbrewArch] = { - dockerUrl: env.url, - }' - )" - else - continue - fi - if sha256="$(_curl "$url.sha256")"; then - sha256="${sha256%% *}" - if [[ ! "$sha256" =~ ^[[:xdigit:]]{64}$ ]]; then - echo >&2 "error: invalid checksum for $url: '$sha256'" - exit 1 - fi - - export sha256 - doc="$(jq <<<"$doc" -c ' - .arches[env.bashbrewArch].dockerSha256 = env.sha256 - ')" - fi - hasArches["$bashbrewArch"]=1 - if [ -n "$windows" ]; then - continue # Windows doesn't have rootless extras :) - fi - - # https://github.com/moby/moby/blob/v20.10.7/hack/make/binary-daemon#L24 - # "vpnkit is available for x86_64 and aarch64" + # every architecture has "cli", and that is what decides whether we support it (everything else is optional per-architecture, and just narrows down what we can build for it) + artifacts=( cli ) case "$bashbrewArch" in - amd64 | arm64v8) - rootlessExtrasUrl="https://download.docker.com/linux/static/$channel/$arch/docker-rootless-extras-$fullVersion.tgz" - if _curl --head "$rootlessExtrasUrl" > /dev/null; then - if rootlessExtrasSha256="$(_curl "$rootlessExtrasUrl.sha256")"; then - rootlessExtrasSha256="${rootlessExtrasSha256%% *}" - if [[ ! "$rootlessExtrasSha256" =~ ^[[:xdigit:]]{64}$ ]]; then - echo >&2 "error: invalid checksum for $rootlessExtrasUrl: '$rootlessExtrasSha256'" - exit 1 - fi - else - rootlessExtrasSha256= - fi - - export rootlessExtrasUrl rootlessExtrasSha256 - doc="$(jq <<<"$doc" -c ' - .arches[env.bashbrewArch] |= ( - .rootlessExtrasUrl = env.rootlessExtrasUrl - | if env.rootlessExtrasSha256 != "" then - .rootlessExtrasSha256 = env.rootlessExtrasSha256 - end - ) - ')" - fi + windows-*) + urlBase="https://download.docker.com/win/static/$channel/$arch" + ext='zip' + # no dind for Windows, so no need for the engine either + ;; + + *) + urlBase="https://download.docker.com/linux/static/$channel/$arch" + ext='tgz' + # (not every architecture has these -- riscv64 does not have either of the latter two, for example) + artifacts+=( engine rootlessExtras ) ;; esac - done - for alwaysExpectedArch in amd64 arm64v8; do - if [ -z "${hasArches["$alwaysExpectedArch"]:-}" ]; then - echo >&2 "error: missing '$alwaysExpectedArch' for '$version'; cowardly refusing to continue! (because this is almost always a scraping flake or similar bug)" - exit 1 - fi + for artifact in "${artifacts[@]}"; do + case "$artifact" in + cli) file="docker-cli_$fullVersion.$ext" ;; + engine) file="docker-engine_$fullVersion.$ext" ;; + rootlessExtras) file="docker-rootless-extras-$fullVersion.$ext" ;; + esac + if artifactJson="$(dockerArtifact "$artifact" "$urlBase/$file")"; then + doc="$(jq <<<"$doc" --compact-output --arg arch "$bashbrewArch" --argjson artifact "$artifactJson" '.arches[$arch] += $artifact')" + elif [ "$artifact" = 'cli' ]; then + continue 2 + fi + done done + # amd64 and arm64v8 are always expected to have every single artifact + missing="$( + jq <<<"$doc" --raw-output ' + . as $doc + | [ + ( + "amd64", + "arm64v8", + empty + ) as $arch + | ( + [ "arches", $arch, "cliUrl" ], + [ "arches", $arch, "engineUrl" ], + [ "arches", $arch, "rootlessExtrasUrl" ], + [ "containerd", "arches", $arch ], + [ "runc", "arches", $arch ], + empty + ) as $path + | select($doc | getpath($path) | not) + | $path + | join(".") + ] + | join(", ") + ' + )" + if [ -n "$missing" ]; then + fatal "missing '$missing' for '$version'; cowardly refusing to continue! (because this is almost always a scraping flake or similar bug)" + fi + + hasWindows="$(jq <<<"$doc" --raw-output '.arches | has("windows-amd64")')" + # order here controls the order of the library/ file for variant in \ cli \ @@ -292,7 +385,7 @@ for version in "${versions[@]}"; do windows/windowsservercore-ltsc2022 \ ; do base="${variant%%/*}" # "buster", "windows", etc. - if [ "$base" = 'windows' ] && [ -z "${hasArches['windows-amd64']}" ]; then + if [ "$base" = 'windows' ] && [ "$hasWindows" != 'true' ]; then continue fi export variant