I normally prefer to manage my apps on my OSX with brew
I am able to install docker, docker-compose and docker-machine
docker --version Docker version 17.05.0-ce, build 89658be docker-compose --version docker-compose version 1.13.0, build unknown docker-machine --version docker-machine version 0.11.0, build 5b27455
I did not download and run 'Docker for Mac' app.
However when I try to run
> docker run -d -p 80:80 --name webserver nginx docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. See 'docker run --help'.
I have already checked the sock file
ls -lah /var/run/docker.sock /var/tmp/docker.sock ls: /var/run/docker.sock: No such file or directory ls: /var/tmp/docker.sock: No such file or directory
I have also tried this proposed solution: Mac OS X sudo docker Cannot connect to the Docker daemon. Is the docker daemon running on this host?
But I got this error message:
$ eval $(docker-machine env default) Host does not exist: "default"
Is it possible to get a docker service to run by command line tools?
“Cannot connect to the Docker daemon” appears when the Docker CLI is unable to communicate with a Docker daemon instance using your current configuration. This is often because the Docker daemon service has been stopped or disabled. You could also be trying to connect to a remote Docker host that's gone offline.
On MacOS go to the whale in the taskbar > Preferences > Daemon > Advanced, or locate ~/. docker/daemon. json. You can also start the Docker daemon manually and configure it using flags.
On a supported Mac, run:
brew install --cask docker
Then launch the Docker app. Click next. It will ask for privileged access. Confirm. A whale icon should appear in the top bar. Click it and wait for "Docker is running" to appear.
You should be able to run docker
commands now:
docker ps
Because docker is a system-level package, you cannot install it using brew install
, and must use --cask
instead.
Note: This solution only works for Macs whose CPUs support virtualization, which may not include old Macs.
Edit 2022 - It was brought up in the comments section that there has been a licensing change for Docker Desktop. Please consider alternatives below, and check the comments for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With