i'm new to jenkins. currently i have a jenkins server start by docker with this docker-compose file:
version: '3.7'
services:
jenkins:
image: jenkins/jenkins:lts
privileged: true
user: root
ports:
- 50000:50000
container_name: jenkins
volumes:
- ~/jenkins:/var/jenkins_home
- /var/run/docker.sock:/var/run/docker.sock
- /usr/local/bin/docker:/usr/local/bin/docker
then i created a simple pipeline to test the docker inside jenkins. This is the pipeline script:
node {
stage "Create build output"
sh "docker info"
}
and the error is the message below:
Started by user myuser
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/jenkins_home/workspace/test-pip
[Pipeline] {
[Pipeline] stage (Create build output)
Using the ‘stage’ step without a block argument is deprecated
Entering stage Create build output
Proceeding
[Pipeline] sh
+ docker info
/var/jenkins_home/workspace/test-pip@tmp/durable-eb4fd6e4/script.sh: 1: docker: Permission denied
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 127
Finished: FAILURE
after checked some other topic, i already done all of these command:
chmod 777 /var/run/docker.sock
sudo usermod -a -G docker $USER
but nothing works. i also install docker plugin for jenkins. After get inside the jenkins container by this command:
docker exec -it 9729efd670b7 /bin/bash
i do the docker command:
docker info
but the console print out command not found:
bash: docker: command not found
does anyone know what should i config to make jenkins run docker? thank you.