Skip to content

Instantly share code, notes, and snippets.

@PurpleBooth
Last active May 31, 2024 16:56
Show Gist options
  • Save PurpleBooth/9de1ccf357f79151a420d27c340a6b57 to your computer and use it in GitHub Desktop.
Save PurpleBooth/9de1ccf357f79151a420d27c340a6b57 to your computer and use it in GitHub Desktop.
How to use docker in without docker-desktop on mac using lima

First run ths install.sh script

Then add an environment variable so tools you use that use docker can find docker

## Add this to your bashrc if you want this to be permenant
export DOCKER_HOST=ssh://localhost:60006

This will need the lima vm for docker running, you can do that by running

limactl start docker

Next add the below "docker" to your path (as docker). You could do that making a new $HOME/.bin/ directory and adding

export PATH="$HOME/.bin:$PATH"

to your bashrc

Everything should work as normal. Docker compose will be under docker compose, rather than with the hyphen.

#!/usr/bin/env bash
set -euo pipefail
if ! limactl list | grep --fixed-strings "docker" | grep --fixed-strings --quiet "Running"; then
limactl start docker
fi
exec limactl shell docker docker "$@"
#!/usr/bin/env bash
set -euo pipefail
brew install lima
mkdir -p $HOME/.lima/docker
wget --output-document ~/.lima/docker/lima.yaml https://raw.githubusercontent.com/lima-vm/lima/master/examples/docker.yaml
echo "NoHostAuthenticationForLocalhost yes" >> ~/.ssh/config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment