dockergitlab-cioraclelinux

docker pull with platform option is not pulling the correct architecture image


I wanted to download docker images of oraclelinux for amd64 and arm64 architectures. But both are showing same sha256 digest. Why is that?

docker pull --platform=linux/amd64 oraclelinux:7-slim
Trying to pull repository docker.io/library/oraclelinux ...
7-slim: Pulling from docker.io/library/oraclelinux
Digest: sha256:7a46c0134e2cad2d15a98eac50c89f9e0f4640c0461b838672d41ea0710d75c5
Status: Downloaded newer image for oraclelinux:7-slim
oraclelinux:7-slim
docker pull --platform=linux/arm64 oraclelinux:7-slim
Trying to pull repository docker.io/library/oraclelinux ...
7-slim: Pulling from docker.io/library/oraclelinux
Digest: sha256:7a46c0134e2cad2d15a98eac50c89f9e0f4640c0461b838672d41ea0710d75c5
Status: Downloaded newer image for oraclelinux:7-slim
oraclelinux:7-slim

I wanted to use both separately in Gitlab CI-CD as mentioned in How to specify image platform in gitlab-ci.yml . How can I do this?


Solution

  • The digest listed by docker is the manifest list. It will be dereferenced to the platform specific manifest as the image is pulled, but docker lists the manifest list for portability (the same digest can be used other multiple platforms).

    $ regctl manifest get oraclelinux:7-slim
    Name:        oraclelinux:7-slim
    MediaType:   application/vnd.docker.distribution.manifest.list.v2+json
    Digest:      sha256:7a46c0134e2cad2d15a98eac50c89f9e0f4640c0461b838672d41ea0710d75c5
                 
    Manifests:   
                 
      Name:      docker.io/library/oraclelinux:7-slim@sha256:eccab04a8a5299ea5ae6cc51ad697aa01012ff2732c999360c4d218dd9451440
      Digest:    sha256:eccab04a8a5299ea5ae6cc51ad697aa01012ff2732c999360c4d218dd9451440
      MediaType: application/vnd.docker.distribution.manifest.v2+json
      Platform:  linux/amd64
                 
      Name:      docker.io/library/oraclelinux:7-slim@sha256:fd4d966f65ddc0ac1727570766563e2f9d0dd8e2557234d179a017e244e67979
      Digest:    sha256:fd4d966f65ddc0ac1727570766563e2f9d0dd8e2557234d179a017e244e67979
      MediaType: application/vnd.docker.distribution.manifest.v2+json
      Platform:  linux/arm64