Docker Image Repository using AWS ECR (Container Image Repository)

Docker Image Repository using AWS ECR (Container Image Repository)

Amazon ECS is a fully managed container orchestration service that helps you easily deploy, manage, and scale containerized applications. ECS benefit is it comes with AWS configuration and operational best practices built-in. (Docker image & othe open container images (universal std by linux for docker image))

Its like github: versioning repo for container images with many container specific benefits like build, tags/renaming, image specific repo storage, etc.

In AWS ECS, we can create one repo for one image. we can save multiple version (TAGS) of same image in that repo.

Each image will have its own repo.

To push local code to ECS, Using AWS CLI use push command (docker login cmd) mentioned in created repo

While pushing your image to aws repo use tag naming cmd given on aws, rename your image to your version/tag and push image using docker push.

Steps:

  1. Create repo for your image
  2. Login to ECS on local host using AWS CLI and cmd given in repo
  3. Using CLI add the tag/version to your image using cmd given in repo
  4. Use cmd "docker images" to get your renamed image name (Image URi)
  5. Use docker push : to push your renamed image

Re- build image using AWS CLI

if after pushing image version on ECS, we need to make some changes to the code or docker file, we can re build our image using AWS CLI and again rename it to new version and push this new version on ECS.

We can have 1000s of image versions in one ecs repo.

We can offcource automate the above task using jenkins, so that jenkins can fetch our code from github and push it to the Docker repositoty (Amazon ECS)