Reputation: 1128
I have a service that's running inside a Docker container. What we're looking at now is how to upgrade this service. It's started using supervisord and/but we're not allowed to give users access to that supervisord installation. Thus, if we coould kill the container from inside itself, supervisord could pickup on the fact that the process is now dead and restart it. (First step for the service would be to get any updates.)
Is this possible?
Simply running docker run -it --rm ubuntu bash
and inside it running kill 1
to kill the bash process doesn't work - bash
doesn't terminate on the signal it gets (I haven't verified whether the signal arrives).
Upvotes: 1
Views: 918
Reputation: 54790
Instead of using supervisor, use docker run --restart on-failure
. This will restart your service automatically if it exits with a non-zero code. Then just terminate your process with an exit code of 0 (success) to avoid restarting.
Upvotes: 4