Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Jenkins Pipeline Plug-in support Docker Compose?

I'm looking for a way to run Docker-enabled build consisting of multiple containers in Jenkins 2.0.

Are there any plans for native support of Docker Compose in Pipeline, or through CloudBees docker plugins for pipeline.

Or can/must this be addressed by explicit calls sh docker-compose...? Maybe even use them inside try... finally to further control services lifecycle.


EDIT: The first answer was to suggest a way to build docker containers in jenkins. This is not what is needed here. I (EngineerDollery) want to bring up my target platform in jenkins using compose so that I can deploy my app to it and run end-to-end tests.

like image 310
luka5z Avatar asked May 13 '16 16:05

luka5z


People also ask

Can we use Docker in Jenkins pipeline?

Pipeline is designed to easily use Docker images as the execution environment for a single Stage or the entire Pipeline. Meaning that a user can define the tools required for their Pipeline, without having to manually configure agents. Practically any tool which can be packaged in a Docker container.

How do I run a Docker image in Jenkins pipeline?

There are two ways to run Jenkins build steps in such an image. One is to include a Java runtime and Jenkins agent JAR file inside the image, and add a Docker cloud using the Docker plugin. Then the entire agent runs wholly inside the image, so any builds tied to that cloud label can assume a particular environment.

Can Jenkins run Docker container?

Docker Jenkins build file Maven does not need to be installed on the same machine that hosts Jenkins. Only Docker is needed. And finally, if any artifacts are created, the Jenkins Docker build places these in the workspace in the local file system so they persist after the container is taken offline.


1 Answers

After searching in Jenkins bug tracking, JENKINS-35025 suggests docker-compose.yml is taken into account when running a job in a docker container, using a maven build.

See also Creating CI pipeline with Jenkins, which assumes docker-compose is installed on your Jenkins server.

Note: a year later (August 2017), docker-compose is still not supported in the Docker Pipeline plugin

July 2018, Ivan Aracki notes in the comments:

Manually installing docker-cli and docker-compose with the same version as host's is the solution for now...

like image 150
VonC Avatar answered Sep 20 '22 06:09

VonC