When I am trying to add Docker to the environment path in my jenkins pipeline, I am getting the following error:
- docker version
Client: Docker Engine - Community
Version: 27.1.1
API version: 1.46
Go version: go1.21.12
Git commit: 6312585
Built: Tue Jul 23 19:57:19 2024
OS/Arch: linux/amd64
Context: default
error during connect: Get “https://docker:2376/v1.46/version”: dial tcp: lookup docker on 127.0.0.11:53: no such host
Due to this, I am unable to move forward with my pipeline.
Below is the Jenkins pipeline:
// Scripted
// Declarative
pipeline {
agent any
//agent {docker {image 'maven:3.6.3'}}
environment {
dockerHome = tool 'MyDocker'
mavenHome = tool 'myMaven'
PATH = "$dockerHome/bin:$mavenHome/bin:$PATH"
}
stages {
stage('Chekout') {
steps {
sh 'mvn --version'
sh 'docker version'
echo "Build"
echo "PATH - $PATH"
echo "BUILD NUMBER - $env.BUILD_NUMBER"
echo "BUILD ID - $env.BUILD_ID"
echo "JOB NAME - $env.JOB_NAME"
echo "BUILD TAG - $env.BUILD_TAG"
echo "BUILD URL - $env.BUILD_URL"
}
}
stage('Compile') {
steps {
sh "mvn clean compile"
}
}
stage('Dependency Check') {
steps {
sh "mvn dependency:tree"
}
}
stage('Test') {
steps {
sh "mvn test"
}
}
stage('Integeration Test') {
steps {
sh "mvn failsave:integeration-test failsafe:verify"
}
}
}
post {
always {
echo 'Im awesome. I run always'
}
success {
echo 'I run when you are successful'
}
failure {
echo 'I run when you fail'
}
}
}