maybe try running it as sudo docker ... instead of docker .... The user that you are running as may not have permissions to talk to /var/run/docker.sock on that system.
After the installation finishes, Docker usually starts up on its own, but for the next part to work you will need to stop it.
sudo service docker stop
Then run the daemon with the following command:
sudo nohup docker daemon -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock &
The script leaves the daemon running in the background, and with the Docker ready you can test that it is accepting commands.
sudo docker info
To make working with Docker easier, you should add your username to
the Docker users group. Adding a user to the group can be done with the
command underneath by replacing the with your username.
sudo usermod -aG docker
Works with sudo. Is there a way to do it without using sudo ? I tried to change /var/run/docker.sock permissions but it doesnât work. Itâs also weird because it references a file that is owned by my user
Would like to share the my experience, I had also encounter the same error while jenkins trigger build jobs, in order to overcome this issue tried the below mentioned solutions & its work for me.
Error:
====>
[docker-jenkins-job] $ /bin/sh -xe /tmp/hudson2951930380198129000.sh
++ /usr/bin/docker ps -aq --filter ancestor=myapache_image
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
/usr/bin/docker stop
docker: âstopâ requires a minimum of 1 argument.
See â/usr/bin/docker-current stop --helpâ.