user3411289
user3411289

Reputation: 177

'docker-compose' not found error when command was executed in Jenkins job

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

Answers (4)

ionyekanna
ionyekanna

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

cmathews
cmathews

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

reetesh11
reetesh11

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

SLY
SLY

Reputation: 535

Add your docker-compose executable to PATH envvar. Or use fully-specified path like this /usr/local/bin/docker-compose

Upvotes: 13

Related Questions