Use dumb-init to manage the pid 1 process

Normally, when you launch a Docker container, the process you're
executing becomes PID 1, giving it the quirks and responsibilities that
come with being the init system for the container.

There are two common issues this presents:

* In most cases, signals won't be handled properly.
* Orphaned zombie processes aren't properly reaped.

the dumb-init acting like a simple init system. It launches a single
process and then proxies all received signals to a session rooted at
that child process.

Closes-Bug: #1614509
Change-Id: I9d3d04648e151ddc7c6732b92ffd3b6c9fe467ec
(cherry picked from commit 6710bbeb7c)
This commit is contained in:
Jeffrey Zhang 2016-08-18 16:42:02 +08:00 committed by Jeffrey Zhang
parent e10f2f48a4
commit 7b365d77eb
4 changed files with 8 additions and 3 deletions

View File

@ -209,6 +209,8 @@ RUN touch /usr/local/bin/kolla_extend_start \
&& chmod 440 /etc/sudoers \
&& groupadd kolla
RUN rm -f /tmp/kolla_bashrc
RUN rm -f /tmp/kolla_bashrc \
&& curl -sSL https://github.com/Yelp/dumb-init/releases/download/v1.1.3/dumb-init_1.1.3_amd64 -o /usr/local/bin/dumb-init \
&& chmod +x /usr/local/bin/dumb-init
CMD ["kolla_start"]

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/local/bin/dumb-init /bin/bash
set -o errexit
# Wait for the log socket

View File

@ -49,7 +49,7 @@ RUN useradd -m --user-group ansible --groups kolla \
COPY find_disks.py kolla_keystone_service.py kolla_keystone_user.py kolla_sanity.py kolla_zookeeper.py /usr/share/ansible/
COPY ansible.cfg /home/ansible/.ansible.cfg
CMD ["/bin/sleep", "infinity"]
CMD ["/usr/local/bin/dumb-init", "/bin/sleep", "infinity"]
{{ include_footer }}

View File

@ -0,0 +1,3 @@
---
features:
- use dumb-init to manage the pid 1 process