DEV Community

Cover image for Install Docker on Mac M1 without Docker Desktop
Sergej Brazdeikis
Sergej Brazdeikis

Posted on • Originally published at blog.brazdeikis.io

Install Docker on Mac M1 without Docker Desktop

Docker Desktop is the default way to get docker on your machine, and when you search, it suggests installing it. To find the documentation to do it differently - is a hassle.

It remains free for small businesses (fewer than 250 employees AND less than $10 million in annual revenue), personal use, education, and non-commercial open-source projects.

Here I'm sharing the simplest way to go around it.

Docker on Mac with no Docker Desktop

brew install docker docker-compose
Enter fullscreen mode Exit fullscreen mode

Docker Compose on Mac without Docker Desktop

After installing the Docker, you will see the message.

Compose is now a Docker plugin. For Docker to find this plugin, symlink it:
  mkdir -p ~/.docker/cli-plugins
  ln -sfn /opt/homebrew/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose
Enter fullscreen mode Exit fullscreen mode

Just execute the above, and we did not finish yet!

Enjoy!

Free Replacement Docker Desktop

Docker Desktop installs Docker Engine, which can run only on Linux. So far, we have installed only CLI tools. For images to run, we need an environment.

Rancher Desktop replaces Docker Desktop! Happily to Rancher Desktop v1.0.0 was just released with M1 chip compatibility and solved this problem for us!

If you are on the Mac with an M1 chip, download the file with ...mac.aarch64.zip from
releases page on GitHub

Rancher Desktop Dashboard

Rancher Desktop No access error

In case you are a missing directory or existing directory permissions will not compatible, run these:

sudo mkdir /usr/local/bin
sudo chown $USER /usr/local/bin
Enter fullscreen mode Exit fullscreen mode

Other Docker Desktop alternatives

  • Docker + Hyperkit + Minikube: does not work on M1 Macs
  • Podman - lacks of ability to mount volumes from the host OS
  • Lima + nerdctl - It is not really a docker

Thanks for reading!

Enjoy!

Top comments (11)

Collapse
 
rede_akbar profile image
ribonred

hi thanks for the tutorial, want to add..
i've installed like your tutorial in monterey and end up with docker daemon not running. so its solved by

brew install --cask docker

thanks.. hope it help other

Collapse
 
libertxyz profile image
Libert S

By doing that you are installing Docker Desktop which defeats the purpose of this post

Collapse
 
cognitiaclaeves profile image
Jason

Not sure how you got docker to work, here. My understanding is that nerdctl replaces docker. Here's a good walk-through: youtu.be/evWPib0iNgY

( when I tried your command, above, before I had an idea what was going on, I got an error that the application already existed:

% brew install --cask docker
Running `brew update --preinstall`...
==> Auto-updated Homebrew!
Updated 3 taps (homebrew/core, homebrew/cask and caskroom/cask).
==> Updated Formulae
Updated 2 formulae.
==> Updated Casks
Updated 2 casks.

==> Downloading https://desktop.docker.com/mac/main/arm64/74594/Docker.dmg
######################################################################## 100.0%
==> Installing Cask docker
==> Purging files for version 4.5.0,74594 of Cask docker
Error: It seems there is already an App at '/Applications/Docker.app'.
jnorment@Rearc-MBP rancher-docker % brew uninstall --cask docker
Error: Cask 'docker' is not installed.
Enter fullscreen mode Exit fullscreen mode
Collapse
 
sergej_brazdeikis profile image
Sergej Brazdeikis

Ranched Desktop gives a choise to use nerdctl, docker etc. All good!

With the link to video you shared - you can completely go away from docker cli, and for me it is not an option atm.

Thanks for bringing it up!

Collapse
 
olc profile image
onelittlecabbage

I've moved to Rancher Desktop. Thanks for the recommendations!

Collapse
 
mugane profile image
Peter Kionga-Kamau • Edited

Didn't work for me.
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
EC2/Mac ARM cpu, ssh only.

Collapse
 
sergej_brazdeikis profile image
Sergej Brazdeikis

TIl that you cab run Mac CPU on Ec2. Wow

@mugane you need to start the Desktop app via shell than? Since it is replacement for Docker Desktop app. And these apps are UI apps, oriented for UI usage. I’m not sure if you will run into another issues after launching it.

Collapse
 
mugane profile image
Peter Kionga-Kamau • Edited

There is no desktop, the only access we will have is via shell. The only possible access we will ever have is via shell, since it is scripted. Even if we could start a desktop, we would not be able to see it to do anything with it, and even if there were a way to see it, it would be pointless because it is a script, not a human, that is running the setup, and the script doesn't have eyes, or a mouse, or know what to click.

Thread Thread
 
goralive profile image
Igor Nosovsky

Have you solve the issue?

Collapse
 
curiousmindedfellow profile image
ML • Edited

Running on M1 Mac ( Monterey 12.6.3 (21G419) ) with the following Steps:

1 Add docker cask (Note: If you get Error: It seems there is already a Binary at '/usr/local/share/zsh/site-functions/_docker' this means that the previously installed docker cli tools needs removing --> use brew remove docker docker-compose)
2 Add docker CLI tools
3 Reboot
4 Start Docker Desktop app
5 Able to use the CLI tools (Docker Desktop must be running)

brew install --cask docker
brew install docker docker-compose
Enter fullscreen mode Exit fullscreen mode

Test to see if it worked --> Yes !!!

% docker pull nginx:latest
latest: Pulling from library/nginx
5731adb3a4ab: Pull complete 
8785c8f663d3: Pull complete 
023b6bd393e4: Pull complete 
fd8f86b165b0: Pull complete 
8f41e7c12976: Pull complete 
3b5338ea7d08: Pull complete 
Digest: sha256:6650513efd1d27c1f8a5351cbd33edf85cc7e0d9d0fcb4ffb23d8fa89b601ba8
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest 
Enter fullscreen mode Exit fullscreen mode
Collapse
 
sergej_brazdeikis profile image
Sergej Brazdeikis • Edited

This way you install Docker Desktop app which defeats the purpose of this article - to avoid Desktop app, since it became not completely free. See the beginning of the article.

P.S. Thanks for sharing the other way anyway. I’m sure it will help somebody in the future