Keep a self hosted servicestack service open as a docker swarm service without using console readline or readkey
Stealing from this answer for keeping .NET apps alive, you can wait without using Console
which means you don't need to keep stdin open in Docker (docke run -i
) :
private ManualResetEvent Wait = new ManualResetEvent(false);Wait.WaitOne();
Docker will send a SIGTERM on docker stop
and a ctrl-c will send a SIGINT
so those signals should be trapped and then you let the program end with
Wait.Set();