How to ensure to update Docker image on AWS ECS?

风流意气都作罢 提交于 2020-01-02 06:41:18

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/34819201/how-to-ensure-to-update-docker-image-on-aws-ecs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!