简体   繁体   中英

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'
      }
    }



    }

  }

i solve the issue by changing the agent pipline from agent { docker { image 'python:3.6' args '-u 0:0' } } to agent any

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM