Skip to content

Kibana docker image does not respond to SIGTERM #113374

@lchdev

Description

@lchdev

Kibana version:

Tested with latest 7.15.0 and 8.0.0-alpha2

Original install method (e.g. download page, yum, from source, etc.):

Using the official docker.elastic.co/kibana/kibana image

Describe the bug:

The container does not respond to SIGTERM, making it impossible to gracefully shutdown Kibana.

Steps to reproduce:

  1. Execute docker run --rm docker.elastic.co/kibana/kibana:7.15.0
  2. Try to press CTRL+C
  3. Nothing happens

Expected behavior:

The container should respond to the TERM signal and gracefully shutdown

Identified cause:

There are three running processes in the conainer:

bash-4.4$ ps -e --forest
  PID TTY          TIME CMD
    1 ?        00:00:00 tini
    7 ?        00:00:00 node
  952 ?        00:01:04  \_ node

The main "node" process (PID 7) does not respond to SIGTERM (I am not a node specialist, I can't really explain why), only the child node process (952) does. When a SIGTERM is sent to the container, PID1 (tini) forwards it to the main node process (PID 7) only, and nothing happens.

This is different from when Kibana is run with systemd, because by default systemd will send a SIGTERM signal to ALL the processes of the cgroup, causing Kibana to stop gracefully.

As a workaround, I am currently using dumb-init in place of tini, because it behaves like systemd in this regards (sends signals to all spawn processes).

Example Dockerfile:

FROM docker.elastic.co/kibana/kibana:7.15.0

USER root
ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64 /usr/local/bin/dumb-init
RUN chmod +x /usr/local/bin/dumb-init

USER kibana
ENTRYPOINT ["/usr/local/bin/dumb-init", "--"]
CMD ["/usr/local/bin/kibana-docker"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Team:OperationsKibana-Operations TeambugFixes for quality problems that affect the customer experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions