Hi.
A container built on one architecture will not run on another.
Way back when with Docker “you could run a container anywhere you want, as long as it is the x86_64 CPU architecture on Linux.” Now Docker runs on other architectures and Operating Systems besides Linux on x86-64: IBM Z (s390x), IBM Power, ARM, ARM64. Also Docker on Windows is supported and Docker for Windows can run Windows containers and Linux Containers (Linux containers on Windows 10 | Microsoft Learn). Linux cannot run Windows containers.
Docker containers built for those architectures can only on the Docker installed on those architectures.
Many of the Docker Official Images have images that run on multiple Architectures.
Nginx is one.
https://hub.docker.com/_/nginx
And Docker came out with a new image manifest type V2 called the “Fat Manifest” or manifest list.
An image builder can create a docker image for each platform they support, push the images to a repository and then create a “Fat Manifest” and push that to the repository. The Fat Manifest lists the architectures that the docker image will run on. The Fat Manifest makes it easy for a user to pull the image.
If a docker image has a “Fat Manifest” and the docker image is supportted on lets say x86-64
and IBM Z
, then all you need to to is issue a docker image pull
for the docker image. Docker will check to see if there is a Fat Manifest entry for the architecture you are pulling from and if so will pull the image for that architecture.
Example of Nginx’s Fat Manfiest
The get_docker_image_manifest_list is a script I wrote. https://github.com/gforghetti/docker_registry_api_bash_functions
$ get_docker_image_manifest_list -i library/nginx:latest | jq -r '.manifests[].platform'
{
"architecture": "amd64",
"os": "linux"
}
{
"architecture": "arm",
"os": "linux",
"variant": "v7"
}
{
"architecture": "arm64",
"os": "linux",
"variant": "v8"
}
{
"architecture": "386",
"os": "linux"
}
{
"architecture": "ppc64le",
"os": "linux"
}
{
"architecture": "s390x",
"os": "linux"
}
Examples
Ubuntu Linux x86-64
🐳 root@172.16.129.75:[~] $ uname -a
Linux manager.example.com 4.15.0-29-generic #31-Ubuntu SMP Tue Jul 17 15:39:52 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
🐳 root@172.16.129.75:[~] $ docker version
Client:
Version: 18.09.1
API version: 1.39
Go version: go1.10.6
Git commit: 20b6775
Built: Wed Jan 9 16:50:48 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Enterprise
Engine:
Version: 18.09.1
API version: 1.39 (minimum version 1.12)
Go version: go1.10.6
Git commit: 20b6775
Built: Wed Jan 9 16:34:38 2019
OS/Arch: linux/amd64
Experimental: false
🐳 root@172.16.129.75:[~] $ docker image pull nginx:latest
manager.example.com: Pulling nginx:latest...
manager.example.com: Pulling nginx:latest... : Pulling from library/nginx
manager.example.com: Pulling nginx:latest... : Pull complete
manager.example.com: Pulling nginx:latest... : Digest: sha256:3d7a756fbaa821a5835d6cef14c6d84183bdc2d808750121833f4611733df45e
manager.example.com: Pulling nginx:latest... : Status: Downloaded newer image for nginx:latest
manager.example.com: Pulling nginx:latest...
🐳 root@172.16.129.75:[~] $ docker image inspect nginx:latest --format '{{.Os}} {{.Architecture}}'
linux amd64
IBM Z
🐳 gforghetti:[~] $ ssh linux1@148.100.33.181
Warning: Permanently added '148.100.33.181' (ECDSA) to the list of known hosts.
Welcome to Ubuntu 16.04.5 LTS (GNU/Linux 4.4.0-131-generic s390x)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
31 packages can be updated.
0 updates are security updates.
*** System restart required ***
Last login: Thu Nov 2 13:39:06 2017 from 45.18.37.41
linux1@lxdoc01:~$ uname -a
Linux lxdoc01 4.4.0-131-generic #157-Ubuntu SMP Thu Jul 12 15:44:42 UTC 2018 s390x s390x s390x GNU/Linux
linux1@lxdoc01:~$ docker version
Client: Docker Enterprise Edition (EE) 2.0
Version: 17.06.2-ee-16
API version: 1.30
Go version: go1.8.7
Git commit: 9ef4f0a
Built: Thu Jul 26 16:40:41 2018
OS/Arch: linux/s390x
Server: Docker Enterprise Edition (EE) 2.0
Engine:
Version: 17.06.2-ee-16
API version: 1.30 (minimum version 1.12)
Go version: go1.8.7
Git commit: 9ef4f0a
Built: Thu Jul 26 16:39:59 2018
OS/Arch: linux/s390x
Experimental: false
linux1@lxdoc01:~$ docker image pull nginx:latest
latest: Pulling from library/nginx
99e7bb47d7df: Pull complete
2664bbd6f1e4: Pull complete
e1743d552386: Pull complete
Digest: sha256:3d7a756fbaa821a5835d6cef14c6d84183bdc2d808750121833f4611733df45e
Status: Downloaded newer image for nginx:latest
linux1@lxdoc01:~$
linux1@lxdoc01:~$ docker image inspect nginx:latest --format '{{.Os}} {{.Architecture}}'
linux s390x