Ubuntu 16.04 - > ERROR: Couldn't connect to Docker daemon - you might need to run `docker-machine start default`

I am getting error on ubuntu 16.04

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

when i run following command

sudo docker-compose up

Can any one answer ?


assuming your environment variables are set using the following shell command :

eval "$(docker-machine env default)"

then you can find the exact error by running the following shell command:

docker-compose --verbose up -d

many times its a proxy issue or if your running it with charles proxy it can block compose from connecting etc. if it is a proxy issue you can add this to your profile:

export no_proxy=192.168.99.100

If you installed Docker as a snap package try this:

sudo snap start docker

Starting the Docker daemon

Use following command :

sudo systemctl start docker  

or on older distributions, you may need to use:

sudo service docker start

You should add your user in docker group. And then, you can use docker command without 'sudo'.

$ sudo usermod -aG docker ${USER}
$ sudo service docker restart

Next, you have to logout in your OS. Finally, when you login, you can use docker command without 'sudo'.


After

#sudo snap remove docker //only if required
sudo snap install docker

Following command worked for me

docker-compose --verbose up -d

In case docker service is not active, please do any of the following (give priority to first one)

1. sudo snap start docker    
2. sudo systemctl start docker
3 .sudo service docker start