Reputation: 177
When i'm trying to execute docker-compose up
as a shell build step command in Jenkins job, i got response docker-compose: command not found
.
Does anyone have an idea how to fix this?
Itself Jenkins is hosted on CentOS machine.
I've already added user 'jenkins' to 'sudoers' and to user groups: root, jenkins, docker.
Upvotes: 12
Views: 15490
Reputation: 440
This was the command that i was missing
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
I executed that and jenkins was fine
Upvotes: 6
Reputation: 146
I resolved it by setting the environment PATH variable in Jenkins file like this:
stage('test') {
withEnv(["PATH=$PATH:~/.local/bin"]){
sh "bash test.sh"
}
}
Upvotes: 0
Reputation: 701
You have to install docker compose inside Jenkins env. Follow the below link to install https://docs.docker.com/compose/install/
Upvotes: 2
Reputation: 535
Add your docker-compose executable to PATH envvar. Or use fully-specified path like this /usr/local/bin/docker-compose
Upvotes: 13