-
Notifications
You must be signed in to change notification settings - Fork 1
ECR managing images in AWS
Required for for interacting with AWS ECR repository, ie pushing, pulling, deleting images
- Check your terminal session is logged into the correct AWS profile,
aws configure list
. - Next log into ECR via AWS passing the login details to Docker, run:
aws ecr get-login-password --region eu-west-2
| docker login --username AWS --password-stdin
754256621582.dkr.ecr.eu-west-2.amazonaws.com
You should see a following response say you are authorised and logged in. Now you're ready to push, pull, delete images from our repo.
- Make sure you are logged into the correct AWS profile.
- In terminal run
aws ecr list-images --repository-name <name here>
.
For example, for the hale-platform-dev
namespace you would type aws ecr list-images --repository-name jotw-content-devs/hale-platform-dev-ecr
Here we use our dev namespace as an example.
-
Build the image on your local machine. This can be done either via running
make build
or manually building usingdocker build <name> .
. Either way, when you typedocker images
you should see the image in the list. -
Tag the image.
docker tag <local image name> 754256621582.dkr.ecr.eu-west-2.amazonaws.com/jotw-content-devs/hale-platform-dev-ecr:<image name>
- Push the image
docker push 754256621582.dkr.ecr.eu-west-2.amazonaws.com/jotw-content-devs/hale-platform-dev-ecr:<image name in ECR>
Note: when you tag the image, in step 2, that is when you are giving the image it's "name" in ECR. You can choose to name the image the same name as on your local machine or you can give it a new name. Remember the name must match the name inside the k8s manifest file where you specify what image you are pulling.
Run
aws ecr batch-delete-image --repository-name jotw-content-devs/hale-platform-dev-ecr --image-ids imageTag=hale-platform-wordpress imageTag=hale-platform-nginx
Note: imageTag is the you choose in step 2.