Cannot connect to the Docker daemon on macOS
docker, macos, macos-sierra
Solution
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.
Problem
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?
Related problems
- Brew install docker does not include docker engine?
- Install Docker Toolbox on a Mac via command line
- Docker socket is not found while using Intellij IDEA and Docker desktop on MacOS
- How to run "docker-machine create" in OS X?
- Docker can't connect to docker daemon
- Vagrant up failing for VirtualBox provider with E_ACCESSDENIED on host-only network
- E_ACCESSDENIED when creating a host-only interface on virtualbox via vagrant
- Docker warning: failed to get default registry endpoint from daemon