I encountered a problem. The problem is the docker ps
command displays my container's healthy status always as unhealthy
I've reproducted that issue and pushed to Github: https://github.com/korenb/docker-healthcheck-aspnetcore.git
My steps:
- I configured the healthcheck endpoint in aspnetcore project. The path is
/health
- Then I created docker stuff and set HEALTHCHECK property as desribed in official docs
- When I run the container I see its status as unhealthy permanently
The check command is curl --fail http://localhost/health || exit 1
I'm surprised that if I run that command through docker exec <container> curl --fail http://localhost/health
then it works
I get some logs from docker inspect <container>
but I really have no idea what's wrong.
{
"Status": "unhealthy",
"FailingStreak": 22,
"Log": [{
"Start": "2019-03-12T13:27:51.570474Z",
"End": "2019-03-12T13:27:51.6708017Z",
"ExitCode": -1,
"Output": "OCI runtime exec failed: exec failed: container_linux.go:344: starting container process caused \"exec: \\\"curl --fail http://localhost/health || exit 1\\\": stat curl --fail http://localhost/health || exit 1: no such file or directory\": unknown"
},
{
"Start": "2019-03-12T13:27:53.8550082Z",
"End": "2019-03-12T13:27:53.9882208Z",
"ExitCode": -1,
"Output": "OCI runtime exec failed: exec failed: container_linux.go:344: starting container process caused \"exec: \\\"curl --fail http://localhost/health || exit 1\\\": stat curl --fail http://localhost/health || exit 1: no such file or directory\": unknown"
}
]
}
I'm desperate so I hope the community will help me to figure out the problem