1

I'm new to Jenkins and I want to automatize my current workflow a little bit. Right now I push it to the raspberry. Then via SSH I pull the changes, run docker-compose build and docker-compose up afterwards.

My jenkins file is:

pipeline{
    agent any

    stages{
        stage('build'){
            steps{
                script{
                    docker.withTool("default") {
                        sh 'docker-compose build'
                    }
                }

            }

        }

        stage('deploy'){
            steps{
                script{
                    docker.withTool("default") {
                        sh 'docker-compose up'
                    }
                }

            }
        }
    }
}

And when clicking 'build now' I get the following console-output:

[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (build)
[Pipeline] script
[Pipeline] {
[Pipeline] tool
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (deploy)
Stage "deploy" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: No org.jenkinsci.plugins.docker.commons.tools.DockerTool named default found
Finished: FAILURE

I also tried running it with docker.withTool("docker") but that gave me the same results.

1 Answer 1

1

You need to install the Docker Commons plugin? https://plugins.jenkins.io/docker-commons/

Edit: According to this link for I would like to use Docker CLI inside of a Pipeline job

You need to make sure that “default” points to a docker tool inside of Manage Jenkins> Configure System which will also run on the os of the slave.

3
  • I have that plugin installed at version 1.16 (it even got installed during the setup process) Feb 14, 2020 at 17:39
  • @Cowboy_Patrick I amended my original answer. Hope that helps!
    – Argyle
    Feb 14, 2020 at 20:08
  • how would I apply this if I want to use docker compose? Feb 14, 2020 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.