Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cbi-dev] Docker on Jenkins Dash


I’ve been trying hard to get some tests to run within a container in the Jenkins Dash environment.

The main road block is this error:

[Pipeline] {
[Pipeline] sh
[mq-pipeline] Running shell script
+ docker inspect -f . maven:3.5.3-jdk-8-slim

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.26/containers/maven:3.5.3-jdk-8-slim/json: dial unix /var/run/docker.sock: connect: permission denied

As seen, the container is unable to connect to Docker on the host. I then raised the following issue:

The Jenkins user has been given sudo access but that still doesn’t solve my problem since the docker commands are initiated by the Docker plugin. My script says just this:
pipeline { agent { docker { image 'maven:3.5.3-jdk-8-slim' } }

I tried all possible ways like passing args (-u root:sudo, -u 0:0)  to above docker  options. I also tried the dockerfile approach suspecting issue with the docker agent option, even that didn’t work:

agent {
        dockerfile {
            dir 'jenkins'
            args '-u root:root'
            label 'glass-slave1'

I can understand Jenkins user cannot be added to docker group for security reasons but is there any other way out? Has anyone been successful running jobs in containers on Eclipse Dash instances?


Back to the top