5

Running TeamCity 2019.1.4 with one server and three separate agents. Both agents and the server are running in their respective server/agent containers in separate EC2 instances. I want the build artifact (docker image) to be pushed to the ECR. Permission is configured via IAM role. I am getting Unauthorized error when pushing/pulling. Manually pulling image from the agent EC2 host works. But manually pulling from within the agent EC2 container gives the same error. How do I configure the TeamCity agent container to identify itself as the host machine?

PS: An option I am trying to avoid is to run TeamCity agents in a classic mode (manual installation) which will most likely work.

naimdjon
  • 3,162
  • 1
  • 20
  • 41
  • did you tired to login first before pull or push image? `$(aws ecr get-login --no-include-email --region us-west-2)` – Adiii Oct 16 '19 at 11:07
  • there is no `aws` tool in the agent docker image. – naimdjon Oct 16 '19 at 11:27
  • you can find a solution in this [document](https://ngeor.com/2017/12/30/using-aws-ecr-as-a-docker-registry.html) about `teamcity` push to ecr repository. – GNOKOHEAT Oct 16 '19 at 11:35

1 Answers1

9

Do the following:

  • in TeamCity project configuration, add ECR connection.
  • then, in the build configuration, add build feature, add "Docker Support".
  • make sure the choice "Log in to the Docker registry before the build" is checked and you choose the ECR connection from the project configuration.
naimdjon
  • 3,162
  • 1
  • 20
  • 41