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

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAEihVNaeTd9UcvFmoFVPWNuP%3DjTE4S1BrmCxZJ-zy59xVN_iYw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to