mkuf / prind

print in docker - Deploy a containerized Klipper Stack for your 3D Printer
GNU General Public License v3.0
324 stars 82 forks source link

Add docker start timeout. #75

Closed GAZ082 closed 1 year ago

GAZ082 commented 1 year ago

When klipper cannot detect my USB device of any other reason that may not allow the successful completion of the init process the container just get stuck in "starting".

Would be nice to add a timeout (60s) for these cases, where the start process just stops and allows the user to regain control of the CLI.

Thanks.

mkuf commented 1 year ago

I'm not sure if I understand you correctly.
Which container is stuck in starting state? If the referenced device is unavailable, the klipper container won't start at all, a timeout wouldn't take any affect here.

GAZ082 commented 1 year ago

Well, the issue here is that the Klipper container if all is good takes like 9 seconds to boot in my SBC and if the USB is not available it just keeps going and going...(stopped waiting at about 200 seconds).

mkuf commented 1 year ago

9 seconds sounds quite excessive for the klipper container alone.

Nevertheless, this would have to be solved on the docker side, as the code inside the container is not running when the container is in the startup state.

Docker does not provide any way to set a timeout for a container, wether it is at startup or runtime.
You may be able to add a healthcheck to the klipper service in your override file, but I'm not sure if the checks are taken into account if the container is still in starting state.

https://github.com/compose-spec/compose-spec/blob/master/spec.md#healthcheck