我有一些docker容器,它监听RabbitMQ并处理收到的消息.我有一个代码管道,它启动图像的重建并在有代码提交时更新任务.
我的问题是容器将在消息处理期间突然被杀死有任何方式我可以停止容器查杀,直到过程完成并允许它停止,以便新的新容器将自动创建,因为我没关系当前容器使用旧代码处理消息.我的容器正在里面运行python代码.
谢谢
解决方法:
ECS by default sends a SIGTERM:
StopTask
Stops a running task.
When
StopTask
is called on a task, the equivalent of docker stop is
issued to the containers running in the task. This results in a
SIGTERM and a default 30-second timeout, after which SIGKILL is sent
and the containers are forcibly stopped. If the container handles the
SIGTERM gracefully and exits within 30 seconds from receiving it, no
SIGKILL is sent.Note
The default 30-second timeout can be configured on the Amazon ECS
container agent with the ECS_CONTAINER_STOP_TIMEOUT variable. For more
information, see Amazon ECS Container Agent Configuration in the
Amazon Elastic Container Service Developer Guide.