title: How can I find out why a docker container is no longer running?
body: <p>On one of my AWS server I have manually started a detached Docker container running <a href="https://github.com/willnorris/imageproxy" rel="nofollow noreferrer">willnorris/imageproxy</a>. With no warning, it seems to go down after a few days, for no apparent (external) reason. I checked the container logs and the syslog and found nothing.</p>
  <p>How can I find out what goes wrong (this happens every time)?</p>
  <p>This is how I start it:</p>
  <pre><code>ubuntu@local:~ $ ssh ubuntu@my_aws_box
  ubuntu@aws_box:~ $ docker run -dp 8081:8080 willnorris/imageproxy -addr 0.0.0.0:8080
  </code></pre>
  <p>Typically, this is what I do when it seems to have crashed:</p>
  <pre><code>ubuntu@aws_box:~$ docker ps -a
  CONTAINER ID   IMAGE                                                              COMMAND                  CREATED        STATUS                    PORTS                                                                            NAMES
  de63701bbc82   willnorris/imageproxy                                              &quot;/app/imageproxy -ad…&quot;   10 days ago    Exited (2) 7 days ago                                                                                      frosty_shockley
  
  ubuntu@aws_box:~$ docker logs de63701bbc82
  imageproxy listening on 0.0.0.0:8080
  2021/08/04 00:46:42 error copying response: write tcp 172.17.0.2:8080-&gt;172.17.0.1:38568: write: broken pipe
  2021/08/04 00:46:42 error copying response: write tcp 172.17.0.2:8080-&gt;172.17.0.1:38572: write: broken pipe
  2021/08/04 01:29:18 invalid request URL: malformed URL &quot;/jars&quot;: too few path segments
  2021/08/04 01:29:18 invalid request URL: malformed URL &quot;/service/extdirect&quot;: must provide absolute remote URL
  2021/08/04 11:09:49 invalid request URL: malformed URL &quot;/jars&quot;: too few path segments
  2021/08/04 11:09:49 invalid request URL: malformed URL &quot;/service/extdirect&quot;: must provide absolute remote URL
  2021/08/04 13:04:33 error copying response: write tcp 172.17.0.2:8080-&gt;172.17.0.1:41036: write: broken pipe
  </code></pre>
  <p>As you can see, the logs tell me nothing of the crash and the only real thing I have to go by is the exit status: <code>Exited (2) 7 days ago </code>.</p>