ERROR: Couldn't connect to Docker daemon code example

Example 1: macbook Couldn't connect to Docker daemon - you might need to run `docker-machine start default`

$ docker-machine restart default
$ eval $(docker-machine env default)
// Apparently you need to run the eval $(docker-machine env default) every time you run the quick start terminal.

Example 2: ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?

open the terminal and type sudo dockerd and leave it open
open new terminal and type sudo docker-compose up -d or sudo docker-compose build

Example 3: Couldn't connect to Docker daemon at http+docker://localhost

sudo usermod -aG docker $USER
sudo chown $USER /var/run/docker.sock