"--platform" is only supported on a Docker daemon with experimental features enabled

执行构建镜像命令
docker build -t registry.cn-shanghai.aliyuncs.com/task:3.2.2022032501 --rm --platform=linux/amd64,linux/x86_64

  1. 报错:
    "--platform" is only supported on a Docker daemon with experimental features enabled

解决方法:
由于我是在Windows上安装的docker,打开Dashboard,修改"experimental": false为"experimental": true
{
"registry-mirrors": [],
"insecure-registries": [],
"debug": true,
"experimental": true
}

image.png

【linux中参考】https://superuser.com/questions/1247768/how-to-test-experimental-features-in-docker-17-06-2-ce

  1. 报错:
    Error response from daemon: "amd64,linux" is an invalid component of "linux/amd64,linux/x86_64": platform specifier component must match "^[A-Za-z0-9_-]+$": invalid argument
    解决方法:
    修改命令为docker build -t registry.cn-shanghai.aliyuncs.com/task:3.2.2022032501 --rm --platform=linux/x86_64
    成功!

你可能感兴趣的:("--platform" is only supported on a Docker daemon with experimental features enabled)