Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database servers are sent SIGKILL #276

Closed
jnm opened this issue Apr 28, 2020 · 0 comments · Fixed by #278
Closed

Database servers are sent SIGKILL #276

jnm opened this issue Apr 28, 2020 · 0 comments · Fixed by #278
Assignees
Labels

Comments

@jnm
Copy link
Member

jnm commented Apr 28, 2020

…when Docker containers are stopped. Symptoms: data loss; [container] exited with code 137 when stopping foreground container (explanation).

Redis

The entrypoint script should use exec so that the child process receives signals:

su redis -c "redis-server /etc/redis/redis.conf"

In this case, however, exec su is not enough, because su eats the signals. When stopping a foreground container, the following is logged:

Session terminated, terminating shell... ...terminated.
kobo-docker_redis_main_1 exited with code 143

Consulting the official entrypoint show that they use exec gosu redis "$0" "$@":
https://github.com/docker-library/redis/blob/792574dfa561c5c9e8b6bcc48aad76637b49e96c/3.2/docker-entrypoint.sh#L13

gosu is https://github.com/tianon/gosu, "a simple tool grown out of the simple fact that su and sudo have very strange and often annoying TTY and signal-forwarding behavior." We should be able to use exec gosu redis redis-server /etc/redis/redis.conf.

Postgres

It may be enough to prepend exec:

/bin/bash /docker-entrypoint.sh postgres

Mongo

Same as Postgres:

$BASH_PATH /entrypoint.sh mongod

@jnm jnm added the bug label Apr 28, 2020
jnm added a commit that referenced this issue Apr 30, 2020
…and save us from the unfriendly SIGKILL. Fixes #276
@jnm jnm self-assigned this Apr 30, 2020
@jnm jnm closed this as completed in #278 Apr 30, 2020
jnm added a commit that referenced this issue Apr 30, 2020
…and save us from the unfriendly SIGKILL. Fixes #276
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant