What is default platform type in docker image?

Viewed 536

When loading an image from a docker hub in dockerFile command FROM, if the platform is not specified, is it loaded based on the current server architecture?

I mean, when I build dockerfile on amazon linux 2 x86, is docker engine get docker image which can running on linux/x86-64? Thank you!!

1 Answers

The docker build defaults to pulling base images with the platform of the target platform you are building. And that target platform defaults to the platform of your docker host. So if your docker engine is running on linux/amd64, and you do not pass --platform to either docker build or the FROM line, it will attempt to pull linux/amd64 images from a multi platform base image.

You can check your docker host by running:

docker system info --format '{{.OSType}}/{{.Architecture}}'
Related