-
Notifications
You must be signed in to change notification settings - Fork 34
Docker 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.
A task of type Docker plugin needs to be added
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.
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.