0

I'm trying to run a docker container in my jenkins server, but I'm getting the error below, this is a POC but I'm not sure how to solve it. Docker is installed in my mac but for some reason, jenkins can't see it.

/Users/username/.jenkins/workspace/Cypress@2@tmp/durable-7f55789e/script.sh: line 1: docker: command not found

pipeline {
  // Assign to docker slave(s) label, could also be 'any'
  agent {
    label 'docker' 
  }

  stages {
    stage('Docker node test') {
      agent {
        docker {
          // Set both label and image
          label 'docker'
          image 'node:7-alpine'
          args '--name docker-node' // list any args
        }
      }
      steps {
        // Steps run in node:7-alpine docker container on docker slave
        sh 'node --version'
      }
    }

    stage('Docker maven test') {
      agent {
        docker {
          // Set both label and image
          label 'docker'
          image 'maven:3-alpine'
        }
      }
      steps {
        // Steps run in maven:3-alpine docker container on docker slave
        sh 'mvn --version'
      }
    }
  }
} 
msiles
  • 577
  • 2
  • 8
  • 18

0 Answers0