The Docker machine is running but you need to export some environment to establish the connection with the Docker machine. By default, the Docker CLI client is trying to communicate to the daenon using http+unix://var/run/docker.sock. Export the correct environment variables using eval and then try again. You can also just run docker-machine env dev to see the environment variables it will see.
There are two possible reasons for this error message;
- The most common reason is that you are running the command as does not have the permission to access docker.
- The other reason is that you have not started the docker.
Solution for permission denied:
If you don’t have the permission to access docker, then you can fix this either by running the command as root using sudo since the root has permission to access the docker or adding your user to the docker group.
sudo usermod –a –G docker $USER
After this the user has to log out and log back in completely.
Docket not started:
If you don’t have started docker on Ubuntu, then you can start it by using;
sudo systemct1 enable docker # Auto-start on boot
sudo systemct1 start docker #start right now