diff options
| -rw-r--r-- | kolla/docker/base/Dockerfile.j2 | 10 | ||||
| -rw-r--r-- | kolla/docker/bifrost/bifrost-base/build_arg.yml | 3 | ||||
| -rw-r--r-- | kolla/docker/macros.j2 | 18 | ||||
| -rw-r--r-- | kolla/docker/opensearch/opensearch-dashboards/Dockerfile.j2 | 8 | ||||
| -rw-r--r-- | kolla/docker/opensearch/opensearch/Dockerfile.j2 | 8 |
5 files changed, 45 insertions, 2 deletions
diff --git a/kolla/docker/base/Dockerfile.j2 b/kolla/docker/base/Dockerfile.j2 index c0f52b230..731aaaf60 100644 --- a/kolla/docker/base/Dockerfile.j2 +++ b/kolla/docker/base/Dockerfile.j2 @@ -150,7 +150,10 @@ RUN {{ macros.install_packages(base_rocky_yum_repo_packages | customizable("rock # Install base packages {{ macros.enable_extra_repos(['epel']) }} -{{ macros.install_packages(base_rocky_packages | customizable("rocky_packages")) }} +{# NOTE(mnasiadka): systemd (pulled in by lvm2 and iscsi-initiator-utils) creates + /etc/machine-id, which must not be shared by all containers. #} +{{ macros.install_packages(base_rocky_packages | customizable("rocky_packages")) }} \ + && rm -f /etc/machine-id {# endif for base_package_type rpm #} {% elif base_package_type == 'deb' %} @@ -228,7 +231,6 @@ COPY apt_preferences /etc/apt/preferences.d/kolla-custom {% set base_apt_packages = [ 'apt-utils', 'dumb-init', - 'systemd-standalone-sysusers', 'gawk', 'iproute2', 'kmod', @@ -248,6 +250,7 @@ COPY apt_preferences /etc/apt/preferences.d/kolla-custom 'python3-yaml', 'socat', 'sudo', + 'systemd', 'tgt', 'uuid-runtime', 'patch' @@ -294,6 +297,9 @@ RUN apt-get --error-on=any update \ && apt-get -y upgrade \ && apt-get -y dist-upgrade \ && {{ macros.install_packages(base_apt_packages | customizable('apt_packages'), True) }} \ + {#- NOTE(mnasiadka): systemd creates /etc/machine-id, which must not be + shared by all containers. #} + && rm -f /etc/machine-id \ # NOTE: python3-pip installs dependent tzdata package and blocks mount in docker - 2091161 && unlink /etc/localtime diff --git a/kolla/docker/bifrost/bifrost-base/build_arg.yml b/kolla/docker/bifrost/bifrost-base/build_arg.yml index 8c810f133..02c3359fd 100644 --- a/kolla/docker/bifrost/bifrost-base/build_arg.yml +++ b/kolla/docker/bifrost/bifrost-base/build_arg.yml @@ -5,3 +5,6 @@ install_dib: true create_image_via_dib: false ansible_python_interpreter: /var/lib/kolla/venv/bin/python internal_ip: "127.0.0.1" +# Bifrost's OCI artifact registry runs podman as a systemd service, which +# doesn't work inside a container; kolla-ansible disables it too. +enable_registry: false diff --git a/kolla/docker/macros.j2 b/kolla/docker/macros.j2 index 6d43b4ccf..f44cad572 100644 --- a/kolla/docker/macros.j2 +++ b/kolla/docker/macros.j2 @@ -68,6 +68,24 @@ RUN usermod --append --home {{ homedir }} --groups kolla {{ name }} \ {%- endif %} {%- endmacro %} +{# NOTE(mnasiadka): Some Debian/Ubuntu packages call systemctl or + systemd-tmpfiles from their maintainer scripts without checking that + systemd is running, which fails during an image build. Replace them with + /bin/true while installing such packages, and restore them afterwards. #} +{% macro disable_systemd_commands() -%} +{% for cmd in ['/usr/bin/systemctl', '/usr/bin/systemd-tmpfiles'] -%} + dpkg-divert --local --rename --add {{ cmd }} && ln -s /bin/true {{ cmd }} + {%- if not loop.last %} && {% endif %} +{%- endfor %} +{%- endmacro %} + +{% macro restore_systemd_commands() -%} +{% for cmd in ['/usr/bin/systemctl', '/usr/bin/systemd-tmpfiles'] -%} + rm -f {{ cmd }} && dpkg-divert --local --rename --remove {{ cmd }} + {%- if not loop.last %} && {% endif %} +{%- endfor %} +{%- endmacro %} + {% macro enable_extra_repos(repos) %} {{ handle_repos(repos, 'enable') }} diff --git a/kolla/docker/opensearch/opensearch-dashboards/Dockerfile.j2 b/kolla/docker/opensearch/opensearch-dashboards/Dockerfile.j2 index f6bd31587..3d145930a 100644 --- a/kolla/docker/opensearch/opensearch-dashboards/Dockerfile.j2 +++ b/kolla/docker/opensearch/opensearch-dashboards/Dockerfile.j2 @@ -14,7 +14,15 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" {% set opensearch_dashboards_packages = ['opensearch-dashboards'] %} +{% if base_package_type == 'deb' %} +{# NOTE(mnasiadka): The opensearch-dashboards postinst runs systemctl and + systemd-tmpfiles without checking whether systemd is running. #} +RUN {{ macros.disable_systemd_commands() }} \ + && {{ macros.install_packages(opensearch_dashboards_packages | customizable("packages"), chain=True) }} \ + && {{ macros.restore_systemd_commands() }} \ +{% else %} {{ macros.install_packages(opensearch_dashboards_packages | customizable("packages")) }} \ +{% endif %} && chown -R opensearch-dashboards:opensearch-dashboards /usr/share/opensearch-dashboards COPY extend_start.sh /usr/local/bin/kolla_extend_start diff --git a/kolla/docker/opensearch/opensearch/Dockerfile.j2 b/kolla/docker/opensearch/opensearch/Dockerfile.j2 index 2765d9985..fca2efff5 100644 --- a/kolla/docker/opensearch/opensearch/Dockerfile.j2 +++ b/kolla/docker/opensearch/opensearch/Dockerfile.j2 @@ -18,7 +18,15 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" ENV OPENSEARCH_INITIAL_ADMIN_PASSWORD="Kolla24OpenSearch" +{% if base_package_type == 'deb' %} +{# NOTE(mnasiadka): The opensearch postinst runs systemctl and + systemd-tmpfiles without checking whether systemd is running. #} +RUN {{ macros.disable_systemd_commands() }} \ + && {{ macros.install_packages(opensearch_packages | customizable("packages"), chain=True) }} \ + && {{ macros.restore_systemd_commands() }} \ +{% else %} {{ macros.install_packages(opensearch_packages | customizable("packages")) }} \ +{% endif %} && chown -R opensearch:opensearch /usr/share/opensearch \ && rm -f /etc/opensearch/*.pem \ && rm -f /etc/opensearch/securityadmin_demo.sh |
