Public Repository

Last pushed: a year ago
Short Description
GoCD - Continuous Delivery server - www.go.cd
Full Description

This repository can be used to bring up a GoCD Server and Agent, in a container. The server has been configured to reload plugins without having to restart the server, and so, this image can be used to ease development of plugins.

This is useful for development (specifically plugin development) only, and should NOT be used for running a production Go Server. For one, all your data will be wiped out when the container exits. You have been warned.

Usage

You can watch a video on YouTube (youtu.be/cOZ-ysWWO2A) about the usage, or read about it below. [Please note that the video references gocd/gocd-test, the older Docker repository. You should be using this one, gocd/gocd-dev instead]

Start the container with this:

docker run -tiP gocd/gocd-dev

You'll see docker download the image (might take a little while, the first time), and then the GoCD Server will start up. You'll see messages in blue, telling you what is happening. Once the server has come up, and the dashboard is accessible, you'll get a message about the command you can run to find out which port docker used for this container. The GoCD Agent will come up, after this message and connect to the running GoCD Server.

"Installing" (or updating) a plugin

To install a plugin, the plugin file needs to be copied to /var/lib/go-server/plugins/external on the container. Even though docker cp is now able to copy files from the host to the container (as of Docker 1.8), the ownership of the copied file changes to root. So, here's what you can use to copy a plugin over to the container:

docker exec -i CONTAINER-ID sh -c 'OUTFILE=/var/lib/go-server/plugins/external/curl-plugin.jar; cat >/tmp/temp.go.plugin; chown go:go /tmp/temp.go.plugin; mv /tmp/temp.go.plugin "$OUTFILE"' <my-new-curl-plugin.jar

Assuming you have a file called "my-new-curl-plugin.jar", this will copy it over to the container (into the path /var/lib/go-server/plugins/external/curl-plugin.jar) with the correct ownership. You can find the container ID using docker ps.

Getting into the container

Sometimes, you need a shell inside the container (to create test repositories, etc). docker provides an easy way to do that:

docker exec -i -t CONTAINER-ID bash

To check the server logs, you can do this:

docker exec -i -t CONTAINER-ID tail -f /var/log/go-server/go-server.log

Additional information

  • If you start the container with the -P option, as mentioned above, and missed the messages about finding the correct ports for the server, the message is reproduced here:

      If you're using docker on a Linux box, you can do this:
      echo http://localhost:$(docker inspect --format='{{(index (index .NetworkSettings.Ports "8153/tcp") 0).HostPort}}' CONTAINER-ID)
    
      If you're using docker through boot2docker, on a Mac, do this:
      echo http://$(boot2docker ip):$(docker inspect --format='{{(index (index .NetworkSettings.Ports "8153/tcp") 0).HostPort}}' CONTAINER-ID)
    
  • Starting the server on a known port:

       docker run -i -t -p 8153:8153 gocd/gocd-dev
    

    Then, you can access the Go Server on either:

    1. With plain Docker: http://localhost:8153 (plain Docker)

    2. With boot2docker: http://BOOT2DOCKER-IP:8153 (where BOOT2DOCKER-IP can be found using boot2docker ip)

  • Sources of this docker container (the Dockerfile, etc) are here, on GitHub.

Docker Pull Command
Owner
gocd

Comments (0)