skip to Main Content

I have a question about the architecture of docker images.

For example, alpine:latest provides the image for linux/arm/v8 architecture.
We can pull this image by specifying the linux/arm64 platform:

$ docker pull --platform linux/arm64 alpine
$ docker image inspect alpine
...
        "Architecture": "arm64",
        "Variant": "v8",
        "Os": "linux",
...

I figured out that this result implies linux/arm64 is an alias for linux/arm64/v8.
In another experiments, I found the following similar behaviors:

  • --platform linux/arm/v8 pulls linux/arm64 image
  • --platform linux/arm pulls linux/arm/v7 image
  • --platform linux/arm/v7 pulls linux/arm image

Could you please explain the definition of such aliases, or the rules for resolving the architecture? Or is there an official guide?

Thanks.

2

Answers


  1. The Docker documentation has this list:

    Architectures other than amd64?
    
    Some images have been ported for other architectures, and many of these are officially supported (to various degrees).
    
        Architectures officially supported by Docker, Inc. for running Docker: (see download.docker.com)
            ARMv6 32-bit (arm32v6): https://hub.docker.com/u/arm32v6/
            ARMv7 32-bit (arm32v7): https://hub.docker.com/u/arm32v7/
            ARMv8 64-bit (arm64v8): https://hub.docker.com/u/arm64v8/
            Linux x86-64 (amd64): https://hub.docker.com/u/amd64/
            Windows x86-64 (windows-amd64): https://hub.docker.com/u/winamd64/
        Other architectures built by official images: (but not officially supported by Docker, Inc.)
            ARMv5 32-bit (arm32v5): https://hub.docker.com/u/arm32v5/
            IBM POWER8 (ppc64le): https://hub.docker.com/u/ppc64le/
            IBM z Systems (s390x): https://hub.docker.com/u/s390x/
            MIPS64 LE (mips64le): https://hub.docker.com/u/mips64le/
            RISC-V 64-bit (riscv64): https://hub.docker.com/u/riscv64/
            x86/i686 (i386): https://hub.docker.com/u/i386/
    
    Login or Signup to reply.
  2. I got my own answer to this topic, so let me share it.

    1. In the reference page for docker buildx build command, we can find the following statement:

      The formatting for the platform specifier is defined in the containerd source code.

    2. Open that link. There exists a detailed description of the platform notation. In short,
      • A notation might be normalized by certain rules.
      • The omitted parts can be inferred under certain conditions.

    That’s almost all I needed.


    Appendix

    • The platform linux/arm64/v8 will be normalized as linux/arm64.
    • The default variant for arm architecture is v7.
    • We can omit the OS part; it will be inferred:
      $ docker pull --platform 386 alpine
      $ docker image inspect alpine --format '{{.Os}}/{{.Architecture}}'
      linux/386
      
    • There is a normalization rule:
      $ docker pull --platform x86_64 alpine
      $ docker image inspect alpine --format '{{.Os}}/{{.Architecture}}'
      linux/amd64
      $ docker pull --platform aarch64 alpine
      $ docker image inspect alpine --format '{{.Os}}/{{.Architecture}}'
      linux/arm64
      
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search