Docker container setup for TeamCity server and agent each in their own container. Docker Compose Documentation
Getting Started - Two Methods
Using the default
docker-compose.yml will pull down the two Jetbrains TeamCity Docker images and create containers from those base images.
The alternative method will build custom images from Dockerfiles.
There are two Dockerfiles included. One for the TC server and one for the TC agent. With these files you can further customize what gets installed in your images before creating containers from them.
To create containers using the Dockerfiles you'll want to look at and use
docker-comoose-alt.yml. You can run that compose file
docker-compose -f docker-compose-alt.yml up -d or just rename it to
docker-compose.yml and run docker compose up as usual.
Docker Compose Up
To create the two containers, simply use the standard docker compose command:
`docker-compose up -d`
This will pull down the Docker image for the server and agent and then create a container for each. The containers are auto-linked and
use the default port for the server
I setup some folders for volume mapping. You can choose to use these or you can set your own and delete them. You could also set system volumes which don't map to particular folders at all. I find using my own folders as volumes convenient for reviewing the configuration and data files generated by the containers.
Configure TeamCity Server
Once your containers are up and running, you can navigate to
localhost:8111 to access the Server container. At that point you
setup the server as you would any TeamCity server. Once you're logged in and see the admin interface, you can navigate to
Agents > Unauthorized tab and there you'll see the TeamCity Agent container requesting authorization.
Docker Compose Commands
To cleanup your containers using compose, run this command:
docker-compose down -v --remove-orphans
This will shut down the containers, remove volumes
-v and remove other orphans like auto network setup
Bring the containers back up using the standard compose up command shown above.
NOTE: If you are using the alt compose yml file, you'll need to include that in your down command as well...
docker-compose -f docker-compose-alt.yml down -v --remove-orphans