Jenkins - Docker Plugin

Card Puncher Data Processing


docker plugin

For a docker installation, see Jenkins - Docker Installation

Doc !


Docker workflow Plugin

The run target also makes reference to file paths on the Docker host, assuming they are where you are running that command.

Step covered by this plugin:

  • withDockerContainer: Run build steps inside a Docker container
  • withDockerRegistry: Sets up Docker registry endpoint
  • dockerFingerprintRun: Record trace of a Docker image run in a container
  • withDockerServer: Sets up Docker server endpoint
docker.withServer('tcp://host:1234') {
  docker.withRegistry('') {
      semaphore 'wait'
      sh 'echo would be connecting to $DOCKER_HOST'
      echo "image name is ${docker.image('whatever').imageName()}"
  • dockerFingerprintFrom: Record trace of a Docker image used in FROM
docker.image('maven:3.3.9-jdk-8').withRun("--entrypoint mvn", "-version") {c ->
    sh "docker logs ${}"
node {
  def img = docker.image('httpd:2.4.12')
  def port = img.withRun('-p 12345:80') { c -> c.port(80) }
  echo "container running on ${port}"


docker.image(<image>).inside(opts) {
  sh "<command>"

# example
docker.image('maven:latest').inside {
    sh 'mvn -version'

same as:

sh "docker run --rm -t -e ... <image> <command>"

If you want to override the image's entrypoint you can still use this command:

docker.image("my-image").inside("--entrypoint cat") {}

Docker plugin - Docker plugin allows to use a docker host to dynamically provision build agents, run a single build, then tear-down agent.

Docker plugin works with

Docker plugin is a JCloud Plugin implementation. You'll need to edit to install it and add a new Cloud of type “Docker”.

Share this page:
Follow us:
Task Runner