Skip to content

dlisin/docker-teamcity-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TeamCity Build Agent

TeamCity Build Agent image with a number of preinstalled build tools:

Supported tags and respective Dockerfile links

What's new?

1.2 (2017-06-15)

  • Apache JMeter 3.2

1.1 (2017-06-07)

  • NodeJS 6.x -> 8.x

1.0 (2016-10-25)

  • Initial Release

Usage

Prerequisites

You should have a TeamCity server up and running.

Configuration

Following environment variables are available:

  • TEAMCITY_SERVER: The address of the TeamCity server. Default value: http://localhost:8111/
  • TEAMCITY_AGENT_NAME: The unique name of the agent used to identify this agent on the TeamCity server.
  • TEAMCITY_AGENT_PORT: A port that TeamCity server will use to connect to the agent. Default value: 9090

Create build agent

Use following example to create new container:

docker pull dlisin/teamcity-agent
docker run -d --restart=always --name my-build-agent \
   -e TEAMCITY_SERVER=http://localhost:8111 \
   -e TEAMCITY_AGENT_NAME=my-build-agent \
   dlisin/teamcity-agent

If you need git push with SSH key authentication:

docker run -d --restart=always --name my-build-agent \
   -e TEAMCITY_SERVER=http://localhost:8111 \
   -e TEAMCITY_AGENT_NAME=my-build-agent \
   -v ~/.ssh/id_rsa:/root/.ssh/id_rsa \
   -v ~/.ssh/known_hosts:/root/.ssh/known_hosts \
   -v ~/.gitconfig:/root/.gitconfig \
   dlisin/teamcity-agent

Maven repository

The Local Maven repository created in /root/.m2/repository. This directory can be shared between severals agents with a data container

Example:

docker run -d --name maven-repository -v /root/.m2/repository busybox

docker run -d --restart=always --name agent-01 \
   -e TEAMCITY_SERVER=http://localhost:8111 \
   -e TEAMCITY_AGENT_NAME=agent-01 \
   --volumes-from maven-repository \
   dlisin/teamcity-agent
  
docker run -d --restart=always --name agent-02 \
   -e TEAMCITY_SERVER=http://localhost:8111 \
   -e TEAMCITY_AGENT_NAME=agent-02 \
   --volumes-from maven-repository \
   dlisin/teamcity-agent

Start build agent

docker start my-build-agent

Stop build agent

docker stop my-build-agent

Upgrade

Pull updated image, stop and remove existing build agent, then create new one:

docker pull dlisin/teamcity-agent
docker stop my-build-agent
docker rm my-build-agent
docker run -d --restart=always --name my-build-agent \
   -e TEAMCITY_SERVER=http://localhost:8111 \
   -e TEAMCITY_AGENT_NAME=my-build-agent \
   dlisin/teamcity-agent

Troubleshooting

To view container stdout:

docker logs my-build-agent

To open SSH session to running container:

docker exec -i -t my-build-agent bash

Build

docker build -t dlisin/teamcity-agent .