如何确保在AWS ECS上更新Docker映像? [英] How to ensure to update Docker image on AWS ECS?

查看:304
本文介绍了如何确保在AWS ECS上更新Docker映像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Docker Hub来存储一个专用的Docker映像,该存储库有一个webhook,一旦图像被更新,它调用了一个我建立的服务:




  • 更新ECS任务定义

  • 更新ECS服务

  • 注销旧的ECS任务定义



服务正在运行。运行ECS后,使用新任务定义创建新任务,使用旧任务定义停止任务,并使用新定义返回服务。要点是Docker Image不会被更新,一旦服务在新的任务定义中开始,它保留在旧的图像上。我做错了什么?



如何保证码头图像的更新?

解决方案

在分析AWS ECS日志后,我发现问题出现在ECS Docker身份验证中。



为了解决我已经将以下数据添加到文件/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}}

只需将 YOUR_DOCKER_HUB_AUTH YOUR_DOCKER_HUB_EMAIL 由您自己的信息,它将正常工作。



要查找此信息,您可以在自己的计算机上执行 docker login ,然后在文件中查找数据〜/ .docker / config.json



有关私人注册表验证主题的更多信息,请查看 http://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html


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?

解决方案

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

这篇关于如何确保在AWS ECS上更新Docker映像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆