How to specify image name for platform, OS and version (e.g., arm64v8 ubuntu 1804)?

I want to be able to choose between:

  1. Platform (e.g., i386, amd64, arm64v8)
  2. OS (e.g., ubuntu or alpine)
  3. Version (e.g., 18.04 or 20.04)

Previously, when I was only interested in x86 (i.e., the default on my machine), I would use a tag like ubuntu:18.04, but now I need to incorporate the platform.

I know this must be simple, but it’s not obvious from any documentation I have seen.


When you’re trying to do what?

Alpine. and Ubuntu:

has many versions tags and architectures ?

You shoudnt worry about architecture, since docker will pull the one that fits your host.

but maybe if you tried to described what you’re trying to accomplish, it would be easier to help :slight_smile:

I just figured it out, but for completeness here is a hopefully better explanation:

Previously I would pull an ubuntu 18.04 image using the CLI with:

docker pull ubuntu:18.04

But at that time I was on an Intel processor (x86-64) Mac. It did the right thing and pulled an x86-64 image for me.

Since then, I moved to an Apple-Silicon processor (Armv8.3 aarch64) . When I tried the same command, it pulled an x86-64 version. This worked but not natively and there is a performance penalty. In other words, docker did not pull the appropriate architecture.

I have discovered I can use the following to get the correct host platform architecture:

docker pull arm64v8/ubuntu:18.04

More generically, it means the image is named with ${HOST_ARCH}/${OS_NAME}:${OS_VERSION}, which is what I was searching for.

This information is additionally useful as I am moving towards creating multiple architecture containers.