Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ensure to update Docker image on AWS ECS?

I use Docker Hub to store a private Docker image, the repository has a webhook that once the image is updated it calls a service I built to:

  • update the ECS task definition
  • update the ECS service
  • deregister the old ECS task definition

The service is running accordingly. After it runs ECS creates a new task with the new task definition, stops the task with the old task definition and the service come back with the new definition.

The point is that the Docker Image is not updated, once the service starts in the new task definition it remains with the old image.

Am I doing something wrong? How o ensure the docker image is updated?

like image 687
Felipe Plets Avatar asked Jan 15 '16 20:01

Felipe Plets


People also ask

How do I automatically update Docker images?

By pushing a new Docker image to your repository, Watchtower will automatically trigger a chain of events to update your running container's base Docker image. When Watchtower detects a new push, it will pull the new base image, gracefully shutdown your running container, and start it back up.

Does Docker run update image?

Docker images within a running container do not update automatically. Once you have used an image to create a container, it continues running that version, even after new releases come out. It is recommended to run containers from the latest Docker image unless you have a specific reason to use an older release.


1 Answers

After analysing the AWS ECS logs I found out that the problem was in the ECS Docker authentication.

To solve that I've added the following data to the file /etc/ecs/ecs.config

ECS_CLUSTER=default
ECS_ENGINE_AUTH_TYPE=dockercfg
ECS_ENGINE_AUTH_DATA={"https://index.docker.io/v1/":{"auth":"YOUR_DOCKER_HUB_AUTH","email":"YOUR_DOCKER_HUB_EMAIL"}}

Just replace the YOUR_DOCKER_HUB_AUTH and YOUR_DOCKER_HUB_EMAIL by your own information and it shall work properly.

To find this information you can execute docker login on your own computer and then look for the data in the file ~/.docker/config.json

For more information on the Private Registry Authentication topic please look at http://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html

like image 116
Felipe Plets Avatar answered Nov 01 '22 11:11

Felipe Plets