Skip to content

Instantly share code, notes, and snippets.

@randria
Last active November 15, 2024 09:26
Show Gist options
  • Save randria/f9a4604e1942c80e9d54f383ac5673b9 to your computer and use it in GitHub Desktop.
Save randria/f9a4604e1942c80e9d54f383ac5673b9 to your computer and use it in GitHub Desktop.

docker managed by lima on OSX

no need to install the docker-desktop package

  • We assume you have installed lima with brew
    brew install lima
  • Download docker template
    mkdir -p ${HOME}/.lima/docker
    wget --output-document ${HOME}/.lima/docker/lima.yaml \
       https://raw.githubusercontent.com/lima-vm/lima/refs/heads/master/templates/docker.yaml
    grep -iq '^NoHostAuthenticationForLocalhost yes' ${HOME}/.ssh/config || \
       echo "NoHostAuthenticationForLocalhost yes" >> ${HOME}/.ssh/config
  • Now run the lima vm (hosted by ubuntu) using docker
    limactl start docker
  • Test your first docker container hosted by lima-vm
    limactl shell docker docker run -it -v $HOME:$HOME --rm alpine
  • Check the docker image inside the lima-vm docker
    limactl shell docker docker image ls

To make this lima-vm docker your default docker engine, you just add this line in your session sh file

export DOCKER_HOST=$(limactl list docker --format 'unix://{{.Dir}}/sock/docker.sock')
docker image ls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment