Apple - How do I start the docker daemon on macOS?

The docker setup does not work as in a normal Linux machine, on a Mac it is much more complicated. But it can be done!

  1. brew cask install docker virtualbox
  2. brew install docker-machine
  3. docker-machine create --driver virtualbox default
  4. docker-machine restart
  5. eval "$(docker-machine env default)" # This might throw an TSI connection error. In that case run docker-machine regenerate-certs default
  6. (docker-machine restart) # maybe needed
  7. docker run hello-world

These steps are based on information given in these two questions:

  • Cannot connect to the Docker daemon on macOS
  • Mac OS X sudo docker Cannot connect to the Docker daemon. Is the docker daemon running on this host?.

An alternative solition which worked for me:

  • remove docker and docker-compose installed by brew
  • install Docker Desktop for Mac
  • run it and pass admin credentials to start everything

It resolved issues with "docker deamon not running" as well as some other issues that the other answer didn't (e.g. ports were not redirected with docker installed using brew and worked smoothly with Docker Desktop installation).