willfarrell / docker-autoheal

Monitor and restart unhealthy docker containers.
MIT License
1.34k stars 226 forks source link

Restart Container failed 0- debugging, diagnosing? #111

Open psyciknz opened 1 year ago

psyciknz commented 1 year ago

image

Any way of getting more information as to why it fails?

psyciknz commented 1 year ago

So i had a dig around in the docker-entrypoint and found the command that restarts a container. And contructed the following:

 curl -v -X POST --unix-socket /var/run/docker.sock http://localhost/containers/ba2ac8f3daa4/restart?t=10

When I execute that in the autoheal container, I can see the container that fails restarting.

tmknight commented 8 months ago

This can be accommodated by capturing the result of the API call into stdout.

Though not using the same methodology as this project, here's an example of how this could be accommodated

napalmz commented 4 months ago

I get the same problem but, launching curl command from within autoheal container, everything goes well. Logs:

24-06-2024 06:50:12 Container /apcupsd (38b41cc6f688) found to be unhealthy - Restarting container now with 10s timeout
24-06-2024 06:50:12 Restarting container 38b41cc6f688 failed

Manual restart from container:

/ # curl -v -X POST --unix-socket /var/run/docker.sock http://localhost/containers/38b41cc6f688/restart?t=10
*   Trying /var/run/docker.sock:0...
* Connected to localhost (/run/docker.sock) port 80
> POST /containers/38b41cc6f688/restart?t=10 HTTP/1.1
> Host: localhost
> User-Agent: curl/8.5.0
> Accept: */*
> 
< HTTP/1.1 204 No Content
< Api-Version: 1.45
< Docker-Experimental: false
< Ostype: linux
< Server: Docker/26.1.4 (linux)
< Date: Mon, 24 Jun 2024 10:11:54 GMT
< 
* Connection #0 to host localhost left intact
/ #