title: adding health check to docker container
body: <p>I am trying to add a health check to my docker container so in my Dockerfile I added this line </p>
  
  <p><code>HEALTHCHECK CMD curl --fail http://localhost:8080/health || exit 1</code> </p>
  
  <p>based loosely on this tutorial: <a href="https://howchoo.com/g/zwjhogrkywe/how-to-add-a-health-check-to-your-docker-container" rel="nofollow noreferrer">https://howchoo.com/g/zwjhogrkywe/how-to-add-a-health-check-to-your-docker-container</a> . In my docker-compose file I have added the health check line like this:</p>
  
  <pre><code>    healthcheck:
        test: ["CMD", "curl", "--silent", "--fail", "http://localhost:8080/health"]
  </code></pre>
  
  <p>but the container always reports unhealthy. So if I execute <code>docker exec -it my-container /bin/bash</code> and get inside the container and then execute the health request I get this: </p>
  
  <pre><code>    $ curl --fail http://localhost:8080/health
      curl: (22) The requested URL returned error: 411 Length Required
  </code></pre>
  
  <p>What am I missing? Nginx is already installed in the container so I would like to simply make that URL with <code>/health</code> work.</p>