0

I want to do something fairly simply in my Gitlab CI pipeline - I want to build the docker image and push it to an AWS ECR repo.

I've looked at this Gitlab CI guide and one of the suggestions it makes is using the docker:latest image.

However, in order to access the AWS ECR repo - I'm also going to need to AWS commands - as from what I can see AWS only allows 12 hour tokens for accessing ECR repos.

I've searched docker hub and I can't find any public images that have both docker-in-docker and AWS cli. This is odd - because I imagine this is a very common solution.

Can someone suggest is there another standard way people build and push images to AWS ECR from Gitlab CI?

  • any good reason for using AWS ECR over a private docker registry? with private docker registry you got all the control and flexibility you need, and not bound by AWS tools (and prices...) – Urban48 Mar 9 '18 at 15:07
2

Probably not the best but still an option to consider. Install aws cli dynamically during the build, and possibly save as cached artifact/dependency. pip install awscli --upgrade --user

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.