Using Docker images built on Apple's M1 chip - Apple Silicon chip to deploy with AMD64 architecture mechines such as Linux or Windows (AWS EC2, ECS, Alibaba Cloud Function Compute, etc.) will bring some issues. Therefore, in order to deploy the image built by Apple chips on the above platforms, we need to specify the image to build the AMD64 architecture.
There are several ways to achieve this:
Specify DOCKER_DEFAULT_PLATFORM
parameter in your environment
You can run export DOCKER_DEFAULT_PLATFORM=linux/amd64
directly before building, or put this in your env config files, e.g. .bashrc
, .zshenv
or .zshrc
etc. by doing this will avoid setting it every time.
Specify the platform in the From of the Dockerfile
For example
FROM --platform=linux/amd64 python:3.6
If building with docker-compose
, you can specify paltform: linux/amd64
services:
servername:
platform: linux/amd64
......
Reference source: https://stackoverflow.com/questions/65612411/forcing-docker-to-use-linux-amd64-platform-by-default-on-macos
If there’s something worth discussing, leave a comment and let’s talk!