Run GoCD Docker on Vultr

Vultr

Go to https://www.vultr.com and deploy a Cloud Compute instance near you based on the Docker on Ubuntu 18.04 application image. Vultr Promo

Update System

Log in via SSH

sudo apt update && sudo apt upgrade -y

Install GoCD Server

Look up latest GoCD Server version

docker pull gocd/gocd-server:v20.3.0 #Pull latest server version - gocd does NOT maintin the :latest tag so you will have to look it up.
mkdir /usr/share/godata #Create persistant storage
chown docker:docker /usr/share/godata #Ensure Docker can access folder
docker run -d --name=gocd -p8153:8153 -v /usr/share/godata:/godata -v /home/go:/home/go gocd/gocd-server:v20.3.0

Let’s look at the docker run command:
-d detaches from console - ommit if you are having problems in order to see error messages
--name give the container a distinct name
-p map localport:containerport
-v map localfolder:containerfolder

Install GoCD Agent

Look up latest GoCD Agent version

docker pull gocd/gocd-agent-ubuntu-18.04:v20.3.0
docker run -d --name=gocdagent -e GO_SERVER_URL=http://$(docker inspect --format='{{(index (index .NetworkSettings.IPAddress))}}' gocd):8153/go gocd/gocd-agent-ubuntu-18.04:v20.3.0

this assumes you are running the agent on the same machien and have named the server “gocd”

Open port on Firewall

sudo ufw allow 8153/tcp #Open port 8153 on local firewall

If you are using a Firewall configuration on Vultr be sure to also change it there.

Set autostart on boot

docker update --restart=always gocd gocdagent