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.
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.
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.
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.
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
anddocker-compose
with the same version as host's is the solution for now...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With