ECS/ECR: is common practice to have one repository per image (and associated versions)?

15,750

Solution 1

Yes. And also, possibly, no.

You push images to ECR. How you configure your image is up to you. Ideally, you'd have an image with a single responsibility, but this is your decision.

If you have multiple images, you push to multiple ECRs. If you have a single image doing many things, you can get away with a single ECR.

You can also push multiple images to the same ECR with creative use of tags (e.g. having the "image name or flavour" in the tag using your own naming convention.

Solution 2

  1. It is recommended to push images with the version number of the same type.

For example your-repo:1.1, your-repo:1.2

If you push images with the same that exist in the ECR repository than your old image will be replaced with the new image you are pushing.

  1. It depends on how your application is working. It is always advised to separate container working logically separate.

For example The database image with a persistence volume. So, If a database container dies than it would not affect your data.

Share:
15,750

Related videos on Youtube

aphexlog
Author by

aphexlog

Updated on June 04, 2022

Comments

  • aphexlog
    aphexlog almost 2 years

    So I'm new to ecs/ecr, but it seems like I have to name (with a tag) the image after the repository name in order to push that image to the repository.

    So my question is: Is it intended that the user (me) would ONLY be pushing a single image and any associated versions of that image to a single repository in ecr, thus creating ANOTHER repository if i need to push a completely different image?

    basically, one repo for nginx, one repo for postgressql, etc.

  • gmsharky
    gmsharky over 5 years
    You push images, you dont push containers - see docs.aws.amazon.com/AmazonECR/latest/userguide/…
  • A.Rashad
    A.Rashad about 2 years
    It is a bit weird having to create a repository for each image. what if I have say 100 microservices, each has its own image, do I end up with 100 repos?
  • optimus
    optimus almost 2 years
    The thing I hate above in MrDuk answer is too much unnecessary chat, no code examples, which is poor visibilities for reader and again the answer is not rock solid,(based on confidence) despite the upvotes it should not be marked as an ANSWER.