I have a ECS cluster in AWS which uses the EC2 launch type, with a Task Definition which runs a container image my-app:latest
which it pulls from a ECR repository. I've configured a Service that runs this Task Definition. Now, whenever I push a new image, I want it to run the new image.
So I saw in this thread How do I deploy updated Docker images to Amazon ECS tasks?
That I can use the aws ecs update-service
command. The problem is that I can't get the container instance to pull the new image.
I saw in the docs in Container agent configuration that there is the ECS_IMAGE_PULL_BEHAVIOR
configuration, which you can se to always
, so when launching the EC2 container instance I've configured the user_data
as such:
#!/bin/bash
echo "ECS_CLUSTER=my-cluster" >> /etc/ecs/ecs.config
echo "ECS_IMAGE_PULL_BEHAVIOR=always" >> /etc/ecs/ecs.config
Now after pushing a new image to ECR, I run the aws ecs update-service
command, but it doesn't seem to pull the new image...
Can someone help?