Yes, you can use Docker without Docker Desktop on your Mac!

**UPDATE 2022-06-28**: _I'm still using this setup. Works amazingly. Haven't thought about Docker Desktop until someone gilded me for this post. Thanks!_

I figured out how to use Lima with Portainer to get 99% of the Docker Desktop experience with 100% less Electron. I wrote a post about it [in my blog](https://blog.carlosnunez.me/post/docker-desktop-alternative-for-mac), but I'll summarize it here:

First, install Lima and the Docker CLI: `brew install lima docker`

Then, create a directory for your new Lima VM and clone my example into it:

```
mkdir $HOME/lima_machines &&
curl -sSLo $HOME/lima_machines/docker.yaml \
https://raw.githubusercontent.com/carlosonunez/bash-dotfiles/main/lima_machine.yaml
```

Finally, start your Lima VM: `limactl start $HOME/lima_machines/docker.yaml --tty=false`

Then tell Docker to use the Unix socket that it makes available: `export DOCKER_HOST="unix://$HOME/.lima/docker.sock"`

The YAML for my Lima VM uses Alpine and installs/configures `qus` so that you can run multi-arch Docker containers, even on M1 Macs.

I've been using this setup for the last two days and it's been smooth sailing. Everything (including volume mounts and host-mode networking) works just like it did before and performance is exceptional. (I'm wondering if shared volume performance is any better since it's using sshfs instead of gRPC FUSE.)

Enjoy!

10 thoughts on “Yes, you can use Docker without Docker Desktop on your Mac!”

  1. I do something similar with VMware Fusion and run the docker engine in a VM. I then start the docker daemon in a Linux VM and expose the socket over TCP. In the Mac console I then use a docker context to connect to the VM and I use hgfs to expose my local directory into the VM. I’ll do a blog post one of these days if anyone is interested. The only thing I haven’t set up is vpnkit, but I don’t think it’s that difficult.

    Reply
  2. Thanks for this!

    Since I use a lot of different dev projects per customer, each with their own set of mounted volumes, my understanding is that each would have to be mounted in the Lima VM. Or can I do one generic mount for $HOME/Code (where all my subprojects reside)?

    Reply
  3. Thanks for this rundown. Even though work is paying for docker enterprise licenses I would still rather escape the electron junk that is Docker desktop where I can.

    How does this go with IDE integration? VSCode specifically?

    Edit: I realised this is probably going to work fine because the docker client will exist on your mac.

    Reply
  4. Anyone here try Multipass? It seems to work similarly once you set the docker context to point to the docker engine running in the VM. Only issue I had was a mount disappearing but after setting it up again I haven’t seen the issue so far.

    Reply

Leave a Comment