Docker跨平台编译(AMD,ARM平台)
1. 首先保证docker版本大于等于19.03
docker version
2. 开启docker buildx
# 临时开启
export DOCKER_CLI_EXPERIMENTAL=enabled
export DOCKER_BUILDKIT=1
docker build --platform=local -o . git://github.com/docker/buildx
mkdir -p ~/.docker/cli-plugins && mv buildx ~/.docker/cli-plugins/docker-buildx
3. 编译(移动到Dockerfile目录)
# 示例编译arm版本: linux/amd64,linux/arm64,linux/arm等等
docker buildx build -t nginx:1.18 --platform=linux/arm -o type=docker .