3
votes

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.

1
did you tired to login first before pull or push image? $(aws ecr get-login --no-include-email --region us-west-2)Adiii
there is no aws tool in the agent docker image.naimdjon
you can find a solution in this document about teamcity push to ecr repository.GNOKOHEAT

1 Answers

3
votes

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.