docker.recipes

GoCD

intermediate

Advanced continuous delivery server with pipelines.

Overview

GoCD is an advanced continuous delivery server originally developed by ThoughtWorks, designed around a pipeline-as-code philosophy that emphasizes visualizing and managing complex deployment workflows. Unlike traditional CI/CD tools that focus primarily on build automation, GoCD treats continuous delivery as a first-class citizen with sophisticated pipeline modeling capabilities including fan-in/fan-out dependencies, parallel execution stages, and comprehensive artifact tracing across entire delivery chains. The server component manages pipeline definitions, scheduling, and orchestration while providing a web-based interface for monitoring and controlling deployments. This stack combines the GoCD server with a lightweight Alpine-based agent that handles the actual build and deployment tasks. The server maintains pipeline state, manages artifacts, and provides the web interface at port 8153, while communicating with agents over HTTPS on port 8154. The agent automatically registers with the server and executes jobs assigned to it, creating a scalable architecture where multiple agents can be added to handle increased workload or specialized environments. Development teams managing complex microservices architectures, enterprises requiring audit trails and deployment approval workflows, and organizations transitioning from manual deployments to automated continuous delivery will benefit most from GoCD's pipeline modeling capabilities. The Value Stream Map feature provides end-to-end visibility into how code changes flow through multiple services and environments, making it particularly valuable for teams that need to coordinate deployments across interdependent systems and maintain strict change management processes.

Key Features

  • Pipeline-as-Code configuration using YAML files for version-controlled deployment workflows
  • Value Stream Map visualization showing end-to-end flow from commit to production deployment
  • Fan-in and fan-out pipeline dependencies enabling complex workflow orchestration
  • Built-in artifact promotion between pipeline stages with traceability
  • Agent auto-registration with server discovery and automatic job distribution
  • Template-based pipeline creation for standardizing deployment patterns across teams
  • Stage-level manual approvals and gates for controlled production deployments
  • Real-time pipeline comparison showing differences between environment deployments

Common Use Cases

  • 1Microservices deployment coordination where multiple services must be deployed in specific order
  • 2Enterprise environments requiring approval workflows and audit trails for production changes
  • 3Multi-environment promotion pipelines moving artifacts through dev, staging, and production
  • 4Complex build dependencies where downstream services depend on multiple upstream components
  • 5Regulated industries needing detailed deployment history and change tracking
  • 6Large development teams requiring pipeline templates and standardized deployment processes
  • 7Organizations migrating from Jenkins seeking better pipeline visualization and dependency management

Prerequisites

  • Minimum 2GB RAM for GoCD server with additional 512MB per agent
  • Docker and Docker Compose installed on host system
  • Ports 8153 and 8154 available for GoCD web interface and agent communication
  • Basic understanding of continuous integration and deployment pipeline concepts
  • Git repository access for pipeline configuration and source code management
  • SSL certificate setup recommended for production HTTPS communication between server and agents

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 gocd-server:
3 image: gocd/gocd-server:latest
4 container_name: gocd-server
5 restart: unless-stopped
6 ports:
7 - "8153:8153"
8 - "8154:8154"
9 volumes:
10 - gocd_data:/godata
11 - gocd_home:/home/go
12
13 gocd-agent:
14 image: gocd/gocd-agent-alpine-3.18:latest
15 container_name: gocd-agent
16 restart: unless-stopped
17 depends_on:
18 - gocd-server
19 environment:
20 GO_SERVER_URL: https://gocd-server:8154/go
21 volumes:
22 - gocd_agent:/godata
23
24volumes:
25 gocd_data:
26 gocd_home:
27 gocd_agent:

.env Template

.env
1# No environment variables required for basic setup

Usage Notes

  1. 1Docs: https://docs.gocd.org/current/
  2. 2Access at http://localhost:8153 (HTTPS on 8154)
  3. 3Agent auto-registers with server via GO_SERVER_URL
  4. 4Pipelines: define in UI or config-as-code repo (gocd.yaml)
  5. 5Value Stream Map visualizes end-to-end deployment flow
  6. 6Fan-in/fan-out dependencies built into pipeline model

Individual Services(2 services)

Copy individual services to mix and match with your existing compose files.

gocd-server
gocd-server:
  image: gocd/gocd-server:latest
  container_name: gocd-server
  restart: unless-stopped
  ports:
    - "8153:8153"
    - "8154:8154"
  volumes:
    - gocd_data:/godata
    - gocd_home:/home/go
gocd-agent
gocd-agent:
  image: gocd/gocd-agent-alpine-3.18:latest
  container_name: gocd-agent
  restart: unless-stopped
  depends_on:
    - gocd-server
  environment:
    GO_SERVER_URL: https://gocd-server:8154/go
  volumes:
    - gocd_agent:/godata

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 gocd-server:
5 image: gocd/gocd-server:latest
6 container_name: gocd-server
7 restart: unless-stopped
8 ports:
9 - "8153:8153"
10 - "8154:8154"
11 volumes:
12 - gocd_data:/godata
13 - gocd_home:/home/go
14
15 gocd-agent:
16 image: gocd/gocd-agent-alpine-3.18:latest
17 container_name: gocd-agent
18 restart: unless-stopped
19 depends_on:
20 - gocd-server
21 environment:
22 GO_SERVER_URL: https://gocd-server:8154/go
23 volumes:
24 - gocd_agent:/godata
25
26volumes:
27 gocd_data:
28 gocd_home:
29 gocd_agent:
30EOF
31
32# 2. Create the .env file
33cat > .env << 'EOF'
34# No environment variables required for basic setup
35EOF
36
37# 3. Start the services
38docker compose up -d
39
40# 4. View logs
41docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/gocd/run | bash

Troubleshooting

  • Agent shows as 'Lost Contact' status: Check GO_SERVER_URL environment variable matches server hostname and verify port 8154 connectivity
  • Pipeline fails with 'No agents available': Ensure agent container is running and registered, check agent resources match job requirements
  • Server web interface returns 502 errors: Wait 2-3 minutes for complete server startup, check gocd_data volume permissions
  • Git checkout fails in pipeline: Configure SSH keys or credentials in GoCD server admin settings
  • Pipeline stays in 'Scheduled' state: Verify agent has required resources and check server logs for scheduling conflicts
  • Agent registration fails with SSL errors: Add server SSL certificate to agent trust store or configure GO_SERVER_URL with proper SSL settings

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Ad Space