Alex Latour
Alex Latour

Reputation: 115

Docker container stuck at (health: starting)

I added a new health check to my container like so:

 app:
      ...
       labels:
          - autoheal=true 
       healthcheck:
          test: ["CMD", 'curl -o /dev/null -s -w "%{http_code}\n" http://localhost:3000/health --connect-timeout 30 --max-time 30 | grep 200']
          interval: 30s
          timeout: 60s
          retries: 3
       logging:
          driver: "syslog"
          options:
              syslog-address: "tcp://127.0.0.1:601"
       depends_on:
          - scalyr 

but when i type "docker container ls" the health check is still starting:

"sh run-node" 11 minutes ago Up 5 minutes (health: starting)

Upvotes: 7

Views: 14874

Answers (2)

yudhiesh
yudhiesh

Reputation: 6829

I had a similar issue, I increased the memory allocated to 4.00GB from the default 2.00GB. Just go to Preferences > Resources > Advanced then change the memory amount and Apply & Restart.

Upvotes: 0

jackdbd
jackdbd

Reputation: 5061

I had the same issue, and in my case the problem was that I was using curl, which is not installed in Alpine images by default.

Here is an equivalent HEALTHCHECK with wget (which is available in Alpine):

HEALTHCHECK --interval=30s --timeout=60s --retries=3 \
  CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1

Upvotes: 8

Related Questions