TeamCity on docker, building dotnet core and Angular

I wanted to setup build server for a personal project I’m working on, and I didn’t want to have any dependencies on the machine, so that I could move it easily. And, if I’m honest, the build server was a personal project as well.


  • Build a dotnet core project
  • Build an angular project
  • No dependencies on the machine


I set out to put together a docker-compose file that had everything in it that I needed. This is what I came up with.

Most of this is pretty straightforward.

  • A TeamCity container with log and data directories
  • A TeamCity Agent container that comes with dotnet build dependencies.
  • A TeamCity Agent container that comes with npm.
  • An environment variable (npm.installed) that is added to the npm agent. This will help later.
> docker-compose up -d


Navigate to http://localhost:8111

TeamCity will startup. Follow the directions to configure it using HSQLDB (we’ll use postgres another time) and create a user.

Configure an npm build (I referenced this excellent article).

Now do the following to make sure this build will only run on the correct agent(s):

  • Open your build configuration
  • Click > Edit Configuration Settings
  • Click > Agent Requirements
  • Click > Add New Requirement
  • Require that npm.installed exists as shown below

Now you should be able to run your build.

Hope it helps!