how to build x86_64 image on M1

透過M1會建立arm64版本, 透過 docker inspect IMAGE_ID可以看到

1
2
3
4
5
6
7
8
9
10
$ docker image inspect 0382b9b17bdb
{
...
"Architecture": "arm64",
"Variant": "v8",
"Os": "linux",
"Size": 223036168,
"VirtualSize": 223036168,
...
}

所以建立imagge時,改成

1
$ docker buildx build --platform=linux/amd64 . -t xxx

之後就可按照正常的docker tag、docker push進行操作