본문 바로가기

리눅스

[리눅스] 애플 맥북 실리콘 M1에서 도커 빌드시 오류

728x90

애플 맥북 실리콘 M1에서 도커 빌드 시 오류

[오류] The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

docker buildx build --platform 플래그 추가

docker buildx build -f Dockerfile.arm --platform linux/arm64/v8 -t anti1346/mongo-arm:5.0.8 .

기본 빌더 출력

docker buildx ls
$ docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS  PLATFORMS
default * docker
  default default         running linux/arm64

기존 빌더에 새 노드 추가(--append)

 

docker buildx create --name mycontext1
docker buildx use mycontext1
docker buildx inspect --bootstrap
$ docker buildx inspect --bootstrap
[+] Building 7.7s (1/1) FINISHED
 => [internal] booting buildkit                                 7.7s
 => => pulling image moby/buildkit:buildx-stable-1              7.3s
 => => creating container buildx_buildkit_mycontext10           0.4s
Name:   mycontext1
Driver: docker-container

Nodes:
Name:      mycontext10
Endpoint:  unix:///var/run/docker.sock
Status:    running
Platforms: linux/arm64
docker ps -a
$ docker ps -a
CONTAINER ID   IMAGE                           COMMAND       CREATED         STATUS         PORTS     NAMES
e509ca90bd8d   moby/buildkit:buildx-stable-1   "buildkitd"   3 seconds ago   Up 3 seconds             buildx_buildkit_mycontext10

buildx 이용한 도커 이미지 빌드

docker buildx build -o type=docker -f Dockerfile.arm --platform linux/arm64/v8 -t anti1346/mongo-arm:5.0.8 .
docker push anti1346/mongo-arm:5.0.8

 

- 참고사이트

docker buildx create : https://docs.docker.com/engine/reference/commandline/buildx_create/

 

728x90