Skip to content

Compose to create working TeamCity server with PostgreSQL and Agents


Notifications You must be signed in to change notification settings


Repository files navigation


Compose to create working TeamCity server with PostgreSQL and Agents

state ssl

This configuration use only official images:

teamcity server, teamcity agent, postgres, traefik

How to use

Clone this repository or download the zip.

git clone


All you need is to set a few ENV variables in the example.env file.

Set your Postgres username and password in env.example


After all rename env.example to .env

Don't push .env file in public repositories!

It's all. PostgreSQL already configured according to the JetBrains recommendations

HTTPs support

HTTPs entry point is enabled by default thanks to traefik

If you don't need HTTPs support – use docker-compose-nossl.yml

Build and setup

Next, build the images: make build


docker-compose -f docker-compose.yml build

Now you may start up the service and continue configuring settings in Web Interface: make up


mkdir -p /opt/traefik && touch /opt/traefik/acme.json && chmod 600 /opt/traefik/acme.json
docker-compose -f docker-compose.yml up -d && docker-compose -f docker-compose.yml logs -f -t --tail=10

After initialisation Web Interface will be available on https://yourdockerhost/

Setup DB

Open https://yourdockerhost/

Set PostgreSQL as database type, download JDBC driver

Alt text

Configure DB connection:

Alt text

Authorize your Agent:

Alt text

Done, TeamCity ready to work.


Scaling your 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

You may use JetBrains way to backup or restore your server


If you see a notice that a new version is available, you may update your TeamCity that way:

use make (set your compose file name in Makefile, by default it is docker-compose.yml)

make update


# stop and remove old containers
docker-compose stop
docker-compose down --rmi all

# build new version
docker-compose build --pull --no-cache

# create and up new containers
docker-compose up -d

After an update, you need to reauthorize your agents.

Updating maintenance

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

Platform-specific agents

You can use my preconfigured custom agents with already installed necessary dependencies

Python 3 | Node.js 11, yarn 1.15

Agent info

Ruby | Bundle

Agent info

Node 14

Agent info


Bug reports, bug fixes and new features are always welcome. Please open issues and submit pull requests for any new code.