How to fix ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?
Problem:
You want to run a docker-container or docker-compose application, but once you try to start it, you see this error message:
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
Solution
There are two possible reasons for this error message.
The common reason is that the user you are running the command as does not have the permissions to access docker.
You can fix this either by running the command as root using sudo
(since root has the permission to access docker) or adding your user to the docker
group:
sudo usermod -a -G docker $USER
and then logging out and logging back in completely (or restarting the system/server).
The other reason is that you have not started docker. On Ubuntu, you can start it using
sudo systemctl enable docker # Auto-start on boot
sudo systemctl start docker # Start right now
TechOverflow’s Docker install instructions automatically takes care of starting & enabling the service