Child pages
  • Docker Slaves Plugin
Skip to end of metadata
Go to start of metadata

Plugin Information

View Docker Slaves on the plugin site for more information.

Use Containers to setup build agents, without any constraint on images you can use.

Objectives

- [✓] use ANY docker image, without any jenkins-specific prerequisite

- [✓] no SSHD inside container, no JNLP port exposed over the Internet

- [✓] compose your build à la docker-compose with a main build container and sidecar containers for test database, selenium browser, etc

- [✓] define container used for the build as a Dockerfile stored in project SCM - aka "continuous delivery as code"

- [✓] support Pipeline

- [✓] rely on docker volumes to offer workspace persistence between builds

- [✓] extensibility for various docker hosting solutions

Configuration

In your jobs, new option let you define your build environment as a combination of Docker images / Dockerfiles 

History

1.0.2

Fix support for Docker host credentials
Add support for docker socket bind mount via a dedicated binding container. This let you run `docker build` from your build container

1.0.1

Plugin has been moved to jenkinsci github organization so we can publish it in public update center

0.5 - proof of concept

This version has been released at DevoxxFrance while we demonstrated the plugin, so people can give it a try and let us know if it was useful

Why ?

Why (yet another) Docker plugin ?

Most plugins around use docker as a lightweight virtual machine, but don't embrace containers paradigm shift and how they impact CI/CD. 

This plugin has been designed as a pure experiment during Docker Global Hack Day. It's under active development. Plugin authors are CloudBees employees, but the plugin isn't a CloudBees product, please consider this as individuals public experiment.

Read more on https://dockins.github.io

http://dockins.github.io

Diagnostic

If something goes wrong (sic), please first run Jenkins master with -Dit.dockins.dockerslaves.spi.DockerDriver.verbose=true . This will dump in build log all docker commands ran by the plugin and help us understand the issue.

Then, ask for assistance on jenkins-users mailing list and/or report a bug on https://issues.jenkins-ci.org

Future

There's many possible improvements / features we'd like to experiment.

  • integrate with Pipeline plugin, especially replace DurableTask by a docker based implementation, running docker commands detached (-d) and polling using docker API for execution status. Would need some way to replace the sh step execution
  • consider using a java based docker client for Docker API, so we don't rely on running external commands (and related threads usage)
  • integrate with docker orchestrators (amazon ECS, Kubernetes, Hyper_ ...) as an alternative backend
  • offer isolated Docker host per build, typically relying on docker inside LXD containers.
  • Let build use of docker as part of the build (i.e. bind mount docker.sock in build container)
  • experiment with docker volume plugins (flocker) for workspace snapshoting and offline browsing of the exact workspace for a specific build.
  • experiment pipeline support for volumes
  • support docker 1.12 swarm mode JENKINS-38203
  • expose docker.sock so build can run `doker build` (aka "inception") JENKINS-37088

5 Comments

  1. It appears that this plugin can only run containers from the Jenkins master.   Is that correct?    That would be a non-starter for us, as we protect the master's performance by not running any builds on it.

  2. How can I know which command this plugin launches my docker container? I have configured my job to run in a docker container but the build step always fail without any reason. I only see this message on jenkins job log " Build step 'Execute shell' marked build as failure". If I manually launch a container there is no problem on running the  build script. How can I know the docker command used to launch this container? I want to reproduce this issue manually so I know why this error happens.

  3. I have the same question as Carlton Brown as well.  Is this only available to run on the master?

  4. According to the github readme, it should work with swarm and Kubernetes, so that would move the builds off the master.

  5. It appears it can run in "Swarm Mode" but it does not actually run the container in the "swarm" it just runs on the node it was configured with (you can point it to another node that is in the swarm, but it will not leverage the Swarm load balancing capabilities. For that this plugin must https://docs.docker.com/engine/api/v1.30/#operation/ServiceCreate and then extract the data from there.  However using that API will require Swarm Mode so the plugin would have to check if the container is part of a swarm and if it is a manager and if so rather than create a container, create a service and interact with the service rather than the container.

Write a comment…