Skip to content
This repository has been archived by the owner on Feb 8, 2021. It is now read-only.

Docker plugin

bradeac edited this page Aug 23, 2016 · 2 revisions

Install plugin

  • Download gocd-docker_pipeline_plugin
  • Copy it to Go.CD server plugin external folder (path to go-server/plugins/external)
  • Restart the Go server.

Add a task of Docker plugin type

A task of type Docker plugin needs to be added

Features

The plugin can execute one or more of the docker login, build, push and run commands.

You can also multiple tag the images that are going to be built. There is also a tag postfix feature.

The plugin can be used with the Docker Hub or with a private repository. For using the Docker Hub, just let the Registry URL field empty.

Other good to know info

If build an image and let the Username field empty, the image will be tagged with the Registry username (if that's also empty, no username will appear in the image tag).

The "triggers" for the commands are:

  • docker login - fill in the Registry username and Registry password fields.
  • docker build - fill in the Image tag field.
  • docker push - check Push images (and also Image tag needs to be filled, they go hand in hand).
  • docker run - fill in the Image field.

The Remove all images and containers option deletes ALL the images in containers (users who run, for example, their Go.CD server and agents in docker containers, beware !)

More thorough information about every field can be found by using the plugin. Or, see the screenshots below:

Using the example data used in the screenshots above, it will result in the following docker commands:

Build command:

If you specify a dockerfile path and its name:

docker build -f example/path/Dockerfile -t registry.example.io/username_for_tagging/imagename example/path

If you do not specify a dockerfile path and its name:

docker build -f Dockerfile -t registry.example.io/username_for_tagging/imagename .

If you do not specify a username, it will use the username you provide in the Registry username field.

Login command:

docker login --username=username_for_logging_in --password=password registry.example.io

Push command:

  • docker push registry.example.io/username_for_tagging/imagename:imagetag1
  • docker push registry.example.io/username_for_tagging/imagename:imagetag2
  • docker push registry.example.io/username_for_tagging/imagename:imagetag3

Note: if you fill only the Image tag 1 field, it will only push the image with the tag you specified.