Body: <p>I know this isn't possible through the AWS portal, but we have a scenario where we would like to restart a container that may have died, which isn't <code>essential</code>.</p>
  
  <p>The scenario is along the lines of having a task with half a dozen or so containers, one of which is a container who's only responsibility is to report metrics for the rest of the task. Sometimes this container crashes due to memory allocation errors or something else.</p>
  
  <p>The only options we have right now in this scenario are:</p>
  
  <ul>
  <li>Mark the metrics container as <code>essential</code> so that it will force the entire task (including itself) to restart if it crashes</li>
  <li>Mark the metrics container as not <code>essential</code>, resulting in it remaining down indefinitely if it crashes, until the task is at some time restarted.</li>
  </ul>
  
  <p>Is there a way that I can start the container back up from the local host so that it will come up <em>and</em> reattach itself to the <code>ecs_agent</code> container (so that AWS can continue monitoring it)?</p>
  
Comments: CC BY-SA 4.0
Comments: 2018-09-22T01:33:05.590Z
Comments: Did you consider separating the task into 2? if they are truly decoupled - it would make sense to run the "reporting" container as an isolated service (Service rather than Task). I saw your SO question about missing documentation, so it might be better to avoid non documented of bleeding edges
Comments: orberkov
Comments: CC BY-SA 4.0
Comments: 2019-10-12T14:54:04.383Z
Comments: Wouldn't just killing the specific container and letting ECS restart it resolve the issue?
Comments: Uberhumus
Comments: CC BY-SA 4.0
Comments: 2019-12-23T09:23:35.143Z
Comments: Could you reply to the comment?
Comments: 030
Tags: <amazon-web-services><amazon-ecs>
Title: Can I restart a container within an ECS task group without restarting the entire task?
UserDisplayName: MrDuk
ThreadText: # Can I restart a container within an ECS task group without restarting the entire task?
  
  (Asked by: username_0 on 2018-09-21)
  
  I know this isn't possible through the AWS portal, but we have a scenario where we would like to restart a container that may have died, which isn't `essential`.
  
  The scenario is along the lines of having a task with half a dozen or so containers, one of which is a container who's only responsibility is to report metrics for the rest of the task. Sometimes this container crashes due to memory allocation errors or something else.
  
  The only options we have right now in this scenario are:
  
  * Mark the metrics container as `essential` so that it will force the entire task (including itself) to restart if it crashes
  * Mark the metrics container as not `essential`, resulting in it remaining down indefinitely if it crashes, until the task is at some time restarted.
  
  Is there a way that I can start the container back up from the local host so that it will come up *and* reattach itself to the `ecs_agent` container (so that AWS can continue monitoring it)?
  
  **Tags:** amazon-web-services, amazon-ecs
  
  > **Comments:**
  > **username_1**: Did you consider separating the task into 2? if they are truly decoupled - it would make sense to run the "reporting" container as an isolated service (Service rather than Task). I saw your SO question about missing documentation, so it might be better to avoid non documented of bleeding edges  
  > **username_2**: Wouldn't just killing the specific container and letting ECS restart it resolve the issue?  
  > **username_3**: Could you reply to the comment?  
  
  ---
  
  ## 0 answers
  
  