Jenkinsci/BlueOcean in Docker using Docker Agent

23 views
Skip to first unread message

Theo W

unread,
Apr 10, 2018, 4:22:07 AM4/10/18
to jenkins...@googlegroups.com
Hi all,

I'm running Jenkinsci/Blueocean official image in Docker, and wanted to try using Docker agent in the Declarative Pipeline to start up a gradle container to build the project.

Simple Jenkinsfile as follows:

pipeline {
  agent none
  stages {
    stage('Gradle Build') {
      agent {
          docker {
              image 'gradle:latest'
              args '--rm -v "$PWD":/home/gradle/project -w /home/gradle/project gradle gradle build'
          }
      }
      steps {
        echo 'Hello World'
        echo 'List contents of build directory'
        sh 'ls build'
      }
    }
  }
}

However when executing the pipeline, I see the following log:

[Pipeline] sh
[axpertws-pipe_master-VTRKBPYSKQ2MHDGNJKOHZQ5MPD647OIFZT2MTGW5LI77EO6KMC5A] Running shell script
+ docker inspect -f . gradle:latest

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[Pipeline] sh
[axpertws-pipe_master-VTRKBPYSKQ2MHDGNJKOHZQ5MPD647OIFZT2MTGW5LI77EO6KMC5A] Running shell script
+ docker pull gradle:latest
Warning: failed to get default registry endpoint from daemon (Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?). Using system default: https://index.docker.io/v1/
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

My question is is the jenkinsci/blueocean image supposed to support Docker agents out of the box or do we need to use it as a base image to come up with customized solution such as bind mounting the host docker socket, etc ?

Thanks
Reply all
Reply to author
Forward
0 new messages