abiosoft / caddy-docker

Docker container for Caddy
https://hub.docker.com/r/abiosoft/caddy/
MIT License
768 stars 315 forks source link

Add healthcheck in the docker image #150

Closed pascalandy closed 5 years ago

pascalandy commented 5 years ago

Hi,

Issue

I used 0.10.14 for over a year. I feel it's time to upgrade to 0.11.1 When I start the docker service, I used to do:

docker service create \
--name=${server201} --hostname=${server201} \
--network=${net333} --replicas="1" \
--reserve-memory="12M" --limit-memory="20M" \
--restart-condition="any" --restart-max-attempts="20" \
--update-order="start-first" --update-delay="1s" --update-parallelism="1" --update-monitor="1s" \
--health-start-period="60s" --health-interval="5s" --health-timeout="3s" --health-retries="3" \
--health-cmd "curl -fs http://localhost:2015/ || exit 1" \
--mount type=bind,src="${LOCAL_PATH}/caddy/srv,dst=/srv" \
[...]

Now, with 0.11.1 the --health-cmd is creating an issue and the service can't start. Any idea why?

Then

I would also argue to implement the healthcheck directly in the Dockerfile once we understand the issue.

Thanks! P

abiosoft commented 5 years ago

Are you getting any error messages?

pascalandy commented 5 years ago

The reason is simple: curl is NOT part of the docker image. Actually re-building it and testing.

Will be back :)

abiosoft commented 5 years ago

You can use wget as a fallback

pascalandy commented 5 years ago

I confirm that the healthcheck is working properly now. I guess that why I decided to use my own image back in the days.

I prefer to use curl as it's what I use over many containers I manage. Cheers!