giovtorres / docker-centos7-slurm

Slurm Docker Container on CentOS 7
MIT License
85 stars 56 forks source link

signal handling #7

Closed hholst80 closed 4 years ago

hholst80 commented 4 years ago

I think it might cause a problem that the /bin/bash process is pid 1 inside the container. When the container is requested to stop it takes 10 seconds to shut it down because bash does not propagate signaling as it should, ie. docker kills pid 1 inside the container.

Running supervisord directly as process 1 does not seem to mitigate the problem. The container still need a proper init. See citation below.

Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems.

It shares some of the same goals of programs like launchd, daemontools, and runit. Unlike some of these programs, it is not meant to be run as a substitute for init as “process id 1”. Instead it is meant to be used to control processes related to a project or a customer, and is meant to start like any other program at boot time.

Suggestion:

Use docker-compose 2.4 format and init: true, or, include tini explicitly in the Dockerfile prepended to the ENTRYPOINT.

giovtorres commented 4 years ago

Thank you for the suggestion @hholst80!