'docker-compose command not found in jenkins
I am trying to connect to bitbucket using Jenkins and build an image using docker-compose and push the image built to docker-hub. I am able to connect to the bitbucket using Jenkins pipeline. However, I am running into a docker-compose error in Jenkins when building the pipeline.
I have tried including the full path of the docker-compose in my pipeline, but I am still getting the same error. Also tried, putting it in a path variable, which also resulted in the same error. Below is the code. The docker-compose file is in the exact path as the bitbucket clone in the step 'Cloning Git'. Any help is appreciated, Thank you!
pipeline {
environment {
registry = "xxxx/xxx"
registryCredential = 'xxxxx'
dockerImage = ''
}
agent any
stages {
stage('Cloning Git') {
steps {
git branch: 'dev',
credentialsId: 'xxxx',
url: 'xxxx'
}
}
stage('Printing content') {
steps {
sh 'pwd; ls -l;'
}
}
stage('Building Image') {
steps {
sh './usr/bin/docker-compose -f docker-compose.yml up -d --build'
}
}
}
}
Solution 1:[1]
i solve the issue by changing the agent pipline from agent { docker { image 'python:3.6' args '-u 0:0' } } to agent any
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | 4code |
