Skip to content

Instantly share code, notes, and snippets.

Last active Oct 4, 2021
What would you like to do?
How to use docker in without docker-desktop on mac using lima

First run ths 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
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
echo "NoHostAuthenticationForLocalhost yes" >> ~/.ssh/config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment