title: docker compose healthcheck issue
body: <p>In my docker-compose.yml (version - 2.3), I have setup a healthcheck for couple of services. Here is the relevant yml snippet - </p>
  
  <pre><code>      healthcheck:
          test: ["CMD-SHELL", "/secrets/authz_Startup.sh"]
          interval: 30s
          timeout: 30s
          retries: 3
          start_period: 300s 
  </code></pre>
  
  <p>Here is my authz_Startup.sh content - </p>
  
  <pre><code>#!/bin/bash
  HTTP_STATUS="$(curl -IL --silent https://myHost.com/authz/ping 2&gt;/dev/null | head -n 1 | cut -d ' ' -f 2)";
  if [ "$HTTP_STATUS" = "200" ]; then
      echo "Service started";
      exit 0;
  else
      echo "***Service NOT started*** --&gt; $HTTP_STATUS";  
      exit 1;
  fi
  exit;
  </code></pre>
  
  <p>However, when I run "docker-compose up" and then inspect the health check output using "docker inspect --format='{{json .State.Health}}' CONTAINER_ID | jq", I always get -</p>
  
  <pre><code>{
    "Status": "unhealthy",
    "FailingStreak": 16,
    "Log": [
      {
        "Start": "2018-03-10T16:05:18.361126144+05:30",
        "End": "2018-03-10T16:05:18.668852098+05:30",
        "ExitCode": 1,
        "Output": "***Service NOT started*** --&gt; \n"
      },
      {
        "Start": "2018-03-10T16:05:48.676933885+05:30",
        "End": "2018-03-10T16:05:48.973643139+05:30",
        "ExitCode": 1,
        "Output": "***Service NOT started*** --&gt; \n"
      }
    ]
  }
  </code></pre>
  
  <p>I am however able to run this script from terminal and get "Service started" message. I am also able to see a "200 OK" response when I request the ping url from my browser and the typical response time is in ms. Also, I am able to see the 200 response on my browser much before the service is declared "unhealthy". </p>
  
  <p>I am at my wits end trying to figure out whatever it is that I am not doing right. Can someone please help me with this?</p>