I have installed Jenkins locally on my machine. I pulling some source code from my github repository which has a Docker file in the root directory. I want to build and docker image and push it to docker hub but my build fails with the following message...
docker build -f myapp-web:latest . \n
/Users/Shared/Jenkins/Home/workspace/MyApp@tmp/durable-ee9851e9/script.sh: line 1: docker: command not found
pipeline {
agent any
tools {
maven 'maven_3.6.1'
jdk 'jdk8'
}
stages {
stage('Build') {
steps {
withMaven(maven: 'maven_3.6.1', mavenSettingsConfig: '5d7a8237-6d6a-4189-a907-518900dc7755') {
sh "mvn clean install "
}
}
}
stage('Build Image') {
steps {
script {
sh 'docker build -f myapp-web:latest .'
}
}
}
stage('Deploy Image') {
steps {
withDockerRegistry([credentialsId: "docker-hub", url: ""]) {
sh 'docker push myapp-web:latest'
}
}
}
}
}
Docker is install and running on my local machine and Jenkins is configured with the following plugin Docker pipeline Docker plugin
Any ideas greatly appreciated