Skip to content

Instantly share code, notes, and snippets.

@PurpleBooth
Last active Oct 4, 2021
Embed
What would you like to do?
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