Compose to create working TeamCity server with PostgreSQL and Agents
This configuration use only official images:
Keep in mind, if you already have used this compose ver. 0.5.0 with TeamCity 2017.1.x you can not migrate your data (backups) into compose ver. 0.6.0 with latest TeamCity 2018.1.1, because JetBrains don't support import projects backups from previous major version. See: TeamCity Documentation. Instead you need to rerun your 0.5.0 compose with new teamcity-server (2018.1.1) and migrate data to new format. After this, you may make correct backup for compose 0.6.0 and upgrade to version without anon volumes.
How to use
Clone this repository or download the zip.
git clone https://github.com/Egregors/teamcity-docker-compose.git
First of all, you should set your Postgres username and password variables in
env.example and rename
.env file in public repositories!
It's all. PostgreSQL already configured according to the JetBrains recommendations
To add HTTPs nginx-proxy with Let's Encrypt certificates (see https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion) just set your domain name and email for
nginx service in compose file:
nginx: image: nginx links: - teamcity-server volumes: - "./server/etc/nginx/conf.d/:/etc/nginx/conf.d/" environment: # set your domain name and email! VIRTUAL_HOST: ci.example.com LETSENCRYPT_HOST: ci.example.com LETSENCRYPT_EMAIL: firstname.lastname@example.org
If you don't need HTTPs support – remove
from your docker-compose file (like in
Build and setup
Next, build the images:
cd teamcity-docker-compose docker-compose build
Now you can start up the service and continue configuring settings in Web Interface:
After initialisation Web Interface will be available on
https://yourdockerhost/ (with HTTPs support) or
Set PostgreSQL as database type, upload JDBC driver into
/opt/teamcity/data/lib/jdbc/ then click «Refresh JDBC drivers»
Configure DB connection:
Authorize your Agent:
Done, TeamCity basically ready to work.
Scaling you workers (agents) supported as well. Just use
docker-compose scale command:
docker-compose scale teamcity-agent=3
Keep in mind: currently, agents are stateless
Backup / restore
If you see a notice that a new version is available, you may update your TeamCity that way:
# build new version docker-compose build --pull --no-cache # stop and remove old containers docker-compose stop docker-compose rm # create and up new containers docker-compose up -d
After an update, you need to reauthorize your agents.
Sometimes, during update you may get «maintenance is required» message instead of login page.
It's ok! To login in a maintenance mode you need to enter an authentication token. You may find it in the logs:
docker-compose logs -f
Try to find something like this:
teamcity-server_1 | [TeamCity] Administrator can login from web UI using authentication token: 8755994969038184734
You can use our preconfigured custom agents with already installed necessary dependencies
Python3 / Django / Node.js
Run server + agent:
docker-compose -f docker-compose-custom-agent.yml build docker-compose -f docker-compose-custom-agent.yml up # optional docker-compose -f docker-compose-custom-agent.yml scale teamcity-django-agent=3
Ruby / Bundle
Bug reports, bug fixes and new features are always welcome. Please open issues and submit pull requests for any new code.