简体   繁体   中英

How to deploy docker container image updates from AWS ECR to ECS?

I'm new to both Amazon's ECS and docker, and I don't know how to deploy new images.

I currently create a new image in ECR with

NAME_TAG=my-image-name:my-tag-v1
ECR=my-acct-number.dkr.ecr.us-east-1.amazonaws.com

docker build -t $NAME_TAG .
docker tag -f $NAME_TAG $ECR/$NAME_TAG
$(aws ecr get-login --region us-east-1) #log in
docker push $ECR/$NAME_TAG

At this point I don't know how to deploy the new container from ECR to my cluster.

I created the cluster, task and service using a Cloud Formation template, but updating the TaskDefinition image to $ECR/$NAME_TAG and running a stack update eventually times out and fails with a “service did not stabilize” error.

If I push to my-image-name:latest , my cluster instances do pull down the new image, but they don't run it, and in any case I want to avoid using the mysterious latest tag.

How am I supposed to deploy new images to ECS?

You should be able to deploy your image using a new task definition every time you deploy. The task definition lets you set the image version using the attribute "image"

"image":"my-acct-number.dkr.ecr.us-east-1.amazonaws.com/my-image-name:my-tag-v1"

In case you want to use only one task definition, you will have to build you image and tag it with whatever is defined in the the definition.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM