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

Viewed 11694

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.

4 Answers

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

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"
                }
        }   
Related