2

I installed docker using HomeBrew on Mac.

➜  mattermost-server git:(master) docker --version
Docker version 18.09.1, build 4c52b90

➜  mattermost-server git:(master) which docker
/usr/local/bin/docker

When I run docker, This is the error I get.

➜ mattermost-server git:(master) docker ps Cannot connect to the Docker daemon at **unix:///var/run/docker.sock.

Is the docker daemon running?**

Update: This can be solved by removing existing docker and running brew install cask docker Refer here Cannot connect to the Docker daemon on macOS

Grant Foster
  • 722
  • 2
  • 11
  • 21
Vineel
  • 1,630
  • 5
  • 26
  • 47

3 Answers3

1

You are possibly running docker without sudo user, aren't you?

By default you should run docker with sudo user, if you don't want to do that, folow Manage Docker as a non-root user

Duy Nguyen
  • 985
  • 5
  • 9
  • ➜ ~ git:(master) ✗ sudo docker ps Password: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? – Vineel Jan 21 '19 at 03:10
  • For mac, I suggest to use https://hub.docker.com/editions/community/docker-ce-desktop-mac, try it if you are not using it right now. – Duy Nguyen Jan 21 '19 at 03:14
1

I had the same problem after install docker on my mac (brew cask install docker).

docker --version works, but docker ps or any other docker command results in the error: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

To solve the problem you have to :

  1. Install Virtual Box
  2. run : docker-machine create default to create a virtual machine (mandatory on mac os)
  3. run: docker-machine env default to set the environment
  4. run: eval $(docker-machine env default)

try docker ps or docker version to check that everything is ready.

Jorge Valvert
  • 927
  • 1
  • 11
  • 20
0

We need to run brew cask install docker. This should fix the problem.

Grant Foster
  • 722
  • 2
  • 11
  • 21
Vineel
  • 1,630
  • 5
  • 26
  • 47