xxx2017
xxx2017

Reputation: 217

Running multiple docker containers from one image with different teamcityagent names

I tried to do what is mentioned in: Multiple Docker containers, same image, different config

I did:

docker run --name DockerAgent1 <same image id>
docker run --name DockerAgent2 <same image id>
docker run --name DockerAgent3 <same image id>

But then I get the error:

Agent id=<unknown>. Another agent with name "DockerAgent"(id=173) is registered on the server. Please check you do not have two agents with the same name.

In teamcity I only see DockerAgent under unauthorized.

Also in my dockerfile I have also

ENV AGENT_NAME DockerAgent1

When I remove that from my dockerfile the name of the teamcityagent is ip_[number]

How can I register multiple agents in teamcity, that are using the same image in docker, while each has a different teamcity-agent name.

Upvotes: 1

Views: 2833

Answers (1)

Tarun Lalwani
Tarun Lalwani

Reputation: 146630

You need to give different names to your agent. So use something like below

docker run --name DockerAgent1 -e AGENT_NAME=DockerAgent1 <same image id>
docker run --name DockerAgent2 -e AGENT_NAME=DockerAgent2 <same image id>

Upvotes: 2

Related Questions