Skip to content

Instantly share code, notes, and snippets.

@juancsr
Last active April 17, 2024 15:05
Show Gist options
  • Star 49 You must be signed in to star a gist
  • Fork 14 You must be signed in to fork a gist
  • Save juancsr/5927e6660d6ba5d2a34c61802d26e50a to your computer and use it in GitHub Desktop.
Save juancsr/5927e6660d6ba5d2a34c61802d26e50a to your computer and use it in GitHub Desktop.
Use docker in mac without docker-

Run docker in macos without docker desktop

NOTE: I want disclaimer that this work is not complete mine. Most of the work here is comming from: https://dhwaneetbhatt.com/blog/run-docker-without-docker-desktop-on-macos

Run brew doctor and update to make sure everything is working and up to date

$ brew doctor
$ brew update

According to your OS architecture, you might need to install hyperkit or minikube

$ test $(uname -p) = arm && brew install qemu || brew install hyperkit

Install hyperkit and minikube

$ brew install minikube

Install Docker CLI

$ brew install docker
$ brew install docker-compose

Start minikube

$ bash minikube start

Tell Docker CLI to talk to minikube's VM

$ eval $(minikube docker-env)

Save IP to a hostname

$ echo "`minikube ip` docker.local" | sudo tee -a /etc/hosts > /dev/null

Test

$ docker run hello-world

Install docker-credential-helper

$ install docker-credential-helper

Update your .docker/config.json file to NOT TO USE desktop as credStore

Original (if you had docker-desktop installed)

{
  "credsStore" : "desktop"
}

Update desktop value in credsStore value for osxkeychain After

{
  "credsStore" : "osxkeychain"
}

Portforward ports

Keep in mind that now your ports are being portforward to minikube instead of your localhost. So if you have the 8080 port forwarded insead of localhost:8080 you should get your minikube ip ($ minikube ip) and then do <your_minikube_ip>:8080

@Windelimarcos
Copy link

This is great! Tnks...
The only thing I did to run o a M2 was install qemu instead of hyperkit:
brew install qemu
...
and finally docker is running...

@kapscudi
Copy link

hi,
I tried to do it but I can't install docker-credential-helper, can you help?

@juancsr
Copy link
Author

juancsr commented Aug 16, 2023

hi, I tried to do it but I can't install docker-credential-helper, can you help?

@kapscudi Try the offical repo instructions https://github.com/docker/docker-credential-helpers

@sastorsl
Copy link

Could perhaps replace brew install hyperkit with

test $(uname -p) = arm && brew install qemu || brew install hyperkit

@er1c
Copy link

er1c commented Oct 17, 2023

It's brew install docker-credential-helper

@xama
Copy link

xama commented Nov 24, 2023

Hello
the command: bash minikube start
throws : /opt/homebrew/bin/minikube: /opt/homebrew/bin/minikube: cannot execute binary file
any idea please ? many thanks

@theanh90
Copy link

Hello the command: bash minikube start throws : /opt/homebrew/bin/minikube: /opt/homebrew/bin/minikube: cannot execute binary file any idea please ? many thanks

You should run minikube start instead

@bs10x
Copy link

bs10x commented Dec 14, 2023

how can you run docker with qemu exactly?

@juliangovender
Copy link

how can you run docker with qemu exactly?

minikube start --driver=qemu

@shiv19
Copy link

shiv19 commented Feb 1, 2024

@juancsr , can you please update it to brew install docker-credential-helper on the gist :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment