본문 바로가기
CS/OS

[MacOS] m1 맥북에 도커 설치하기

by judy@ 2022. 12. 31.

m1 맥북에 docker를 설치하게 된 이유

평소 특별한 이유가 없으면 개발을 위한 가상 환경으로는 conda 를 사용했다. 이번에 m1 맥북을 새로 구매하면서, 가상 환경을 위한 프로그램을 설치하려는데, 굳이 conda 를 써야할까? 라는 생각이 들었다. conda는 pip install 과 conda install을 혼용하여 사용하면서, 프로그램 이관 시에 굉장한 어려움을 겪었던 기억이 있다. 뭐 혼용하지 않으면 해결되는 문제일 수도 있지만, 이번 기회에 가상 환경에 대해 고민하게 되면서, docker를 사용해보자는 생각이 들었다...

설치 방법

참고: docker 공식 문서

 

1. 아래에서 Mac with Apple silicon을 선택 (다운로드가 진행됨)

2.  Rosetta 2 설치 (진행하지 않음)

아래로 스크롤하니 다음과 같은 requirements가 있음 (도커 데스크탑을 m1에 설치하려면 기존에는 필수적으로 Rosetta 2가 있었어야 했나보다. recommend이지 필수는 아니라서 로제타 설치는 우선 패스하는 것으로..)

3. 다운로드된 docker.dmg 파일을 더블클릭, 드래그 앤 드롭

4. finder에서 docker를 찾아 더블 클릭하여 실행

  • 유료화와 관련한 설명에 accept(어차피 개인은 무료)
  • /var/lib/docker.sock 을 만드는 것을 허용하기 위해 맥북 비밀번호 입력

5. 설치 확인

터미널에서 아래 명령어 입력 시 표준 출력으로 오류가 발생하지 않고 다음과 같이 출력되면 정상 설치된 것.

$ docker ps -a                            [21:20:39]
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

$ docker run hello-world                  [21:20:42]
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
7050e35b49f5: Pull complete
Digest: sha256:c77be1d3a47d0caf71a82dd893ee61ce01f32fc758031a6ec4cf1389248bb833
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (arm64v8)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

 

마무리

현재는 별 무리없이 사용할 수 있는 것으로 확인된다. 그러나 m1 docker desktop이 Rosetta 2에서 완전히 해방된 것은 아니기에, 이 때문에 실행 중 오류가 발생할 수도 있을 것으로 보임.

반응형