Notes on Starting an x86_64 Docker Daemon on Apple Silicon Using QEMU with Lima
⚠️ This article was automatically translated by OpenAI (gpt-4o-mini). It may be edited eventually, but please be aware that it may contain incorrect information at this time.
I usually use OrbStack as my Docker Daemon, but since compatibility issues with x86_64 are likely to occur on Apple Silicon Macs, I will start an x86_64 Docker Daemon in a VM (QEMU) as an alternative when compatibility issues arise.
Install Lima.
brew install lima
Start the VM using the Docker template with Lima.
limactl start --name=build --arch=x86_64 --tty=false --mount-writable template://docker
Set the Docker context on the Mac.
docker context create lima-build --docker "host=unix:///Users/tmaki/.lima/build/sock/docker.sock"
docker context use lima-build
Check the Docker context on the Mac.
$ docker context ls
NAME DESCRIPTION DOCKER ENDPOINT ERROR
default Current DOCKER_HOST based configuration unix:///var/run/docker.sock
lima-build * unix:///Users/tmaki/.lima/build/sock/docker.sock
orbstack OrbStack unix:///Users/tmaki/.orbstack/run/docker.sock
Run docker run on the Mac.
docker run --rm hello-world
Log into the VM.
limactl shell build
Check the Docker context on the VM.
$ docker context list
NAME DESCRIPTION DOCKER ENDPOINT ERROR
default Current DOCKER_HOST based configuration unix:///var/run/docker.sock
rootless * Rootless mode unix:///run/user/503/docker.sock
Bonus 1. Installation notes for kubectl.
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
sudo chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo chmod 644 /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl
Bonus 2. Installation notes for tanzu.
curl -fsSL https://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub | sudo gpg --dearmor -o /etc/apt/keyrings/tanzu-archive-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/tanzu-archive-keyring.gpg] https://storage.googleapis.com/tanzu-cli-os-packages/apt tanzu-cli-jessie main" | sudo tee /etc/apt/sources.list.d/tanzu.list
sudo apt update
sudo apt install -y tanzu-cli