I recently was following with this tutorial:
https://www.youtube.com/watch?v=ymI02j-hqpU
But when running docker pipeline I had this error:
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get
Fix will require all commands:
Create the docker group.
sudo groupadd docker
Add your user to the docker group.
sudo usermod -aG docker ${USER}
You would need to log out and log back in so that your group membership is re-evaluated or type the following command:
su -s ${USER}
Verify that you can run docker commands without sudo.
docker run hello-world
Then additional commands
sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
sudo chmod g+rwx "$HOME/.docker" -R
And add the last one thats is very very important:
sudo chmod 666 /var/run/docker.sock
Usefull thread:
https://stackoverflow.com/questions/47854463/docker-got-permission-denied-while-trying-to-connect-to-the-docker-daemon-socke
For more advanced scripts from file rights have to be changed like
sudo chmod 777 ./script.sh
and for above to run by jenkins you have to edit in /etc/sudoers.d/90-cloud-init-users file, add this line:
jenkins ALL=(ALL) NOPASSWD: ALL