From f9e634ca6b5e6aa33369858e73433409fe10dd2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Andr=C3=A9?= Date: Fri, 7 Apr 2017 11:35:16 +0200 Subject: [PATCH] Move shebang customization into jinja2 block By setting up the shebang inside a jinja2 block, this allows the operator to use a different init system of simply disable it. This is especially useful with docker 1.13 that comes with its own stripped down init system (a build of tini) that would cause the containers to run double init systems if used with the '--init' command line argument. Change-Id: I220d8cfc81c25471e635b2f5790759f21e788e64 Closes-Bug: #1680770 --- docker/base/Dockerfile.j2 | 6 ++++-- docker/base/start.sh | 2 +- .../make_init_system_configurable-0ee16808b6e90954.yaml | 8 ++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/make_init_system_configurable-0ee16808b6e90954.yaml diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2 index 30a3150f07..2e575df82e 100644 --- a/docker/base/Dockerfile.j2 +++ b/docker/base/Dockerfile.j2 @@ -366,7 +366,8 @@ COPY curlrc /root/.curlrc {% if base_arch == 'x86_64' %} RUN 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 + && chmod +x /usr/local/bin/dumb-init \ + && sed -i 's|#!|#!/usr/local/bin/dumb-init |' /usr/local/bin/kolla_start {% else %} @@ -376,7 +377,8 @@ RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ && python get-pip.py \ && rm get-pip.py \ && pip --no-cache-dir install --prefix='/usr/local' dumb-init==1.1.3 \ - && chmod +x /usr/local/bin/dumb-init + && chmod +x /usr/local/bin/dumb-init \ + && sed -i 's|#!|#!/usr/local/bin/dumb-init |' /usr/local/bin/kolla_start {% endif %} {% endblock %} diff --git a/docker/base/start.sh b/docker/base/start.sh index 3ca6291fc7..2612912686 100644 --- a/docker/base/start.sh +++ b/docker/base/start.sh @@ -1,4 +1,4 @@ -#!/usr/local/bin/dumb-init /bin/bash +#!/bin/bash set -o errexit # Wait for the log socket diff --git a/releasenotes/notes/make_init_system_configurable-0ee16808b6e90954.yaml b/releasenotes/notes/make_init_system_configurable-0ee16808b6e90954.yaml new file mode 100644 index 0000000000..6eb819dfbc --- /dev/null +++ b/releasenotes/notes/make_init_system_configurable-0ee16808b6e90954.yaml @@ -0,0 +1,8 @@ +--- +features: + - Make containers init system configurable. This is particularly useful with + docker 1.13 that comes with its own minimal init and would result in double + init system with used with the `--init` command line argument. +upgrade: + - The operator now needs to customize the shebang as part of the minimal init + install.