Lima 설치

username@mac:workdir $ brew install lima

도커 CLI & compose 바이너리 준비

Homebrew 사용

username@mac:workdir $ brew install docker docker-compose

(Optional) 직접 빌드

username@other-mac-with-docker:workdir $ git clone <https://github.com/docker/cli.git> && cd cli && docker buildx bake
# 빌드된 바이너리: ./build/docker

username@other-mac-with-docker:workdir $ git clone <https://github.com/docker/compose.git> && cd compose && make
# 빌드된 바이너리: ./bin/docker-compose

셋업

# 도커를 위한 Lima 가상머신 생성 & 구동
username@mac:workdir $ limactl start --name=docker docker.yaml

# 로컬 도커 context를 위에서 생성한 Lima 가상머신으로 설정
username@mac:workdir $ export LIMA_HOME="PATH_TO_LIMA_HOME"
username@mac:workdir $ docker context create lima --docker "host=unix://$(LIMA_HOME)/docker/sock/docker.sock"

# Lima VM을 기본 도커 context로 사용하려면
username@mac:workdir $ export DOCKER_CONTEXT="lima"

사용 팁

# 기본
username@mac:workdir $ limactl --help
username@mac:workdir $ limactl info
username@mac:workdir $ limactl ls

# Lima VM 셸에 접속
username@mac:workdir $ limactl shell docker bash

# Lima VM 구동/정지/수정
username@mac:workdir $ limactl start docker
username@mac:workdir $ limactl stop docker
username@mac:workdir $ limactl edit docker

(Optional) docker.yaml 수정해 스펙 조정하기

# Tune VM host spec
cpus: 8
memory: 16GiB
disk: 60GiB

# Mount directories you want to expose
mounts:
- location: "~/Dev/docker"
	writable: true
- location: "~/Downloads"
	writable: true

참조