Couldn't connect to Docker daemon on Mac OS X

Viewed 66606

I would like to run multi-container application using docker-compose on Mac OS X El Capitan (v10.11.2).

However, the command $ docker-compose up command complains that it can't connect to the Docker daemon.

ERROR: Couldn't connect to Docker daemon - you might need to run docker-machine start default.

Only after executing $ eval "$(docker-machine env default)" I do have access to the docker-compose command.

Why is this and how can I overcome this extra step?

5 Answers

In the Quickstart Terminal, I restarted the "default" machine solved my problem

docker-machine restart default
eval $(docker-machine env default)

Then I was able to start composing my container with docker-compose up -d --build

I've written a Homebrew tap, here: https://github.com/nejckorasa/mac-docker-go

It includes a script to start/restart Docker daemon.

Usage: dckr [options]

Options:
  -k  | --kill        Kill Docker daemon
  -s  | --start       Start Docker daemon
  -r  | --restart     Restart Docker daemon
  -ka | --killall     Kill all running Docker containers
  -h                  Display help

  Defaults to restart if no options are present
Related