Add util-linux to centos base packages

Currently /usr/sbin/nologin is missing, because util-linux
is not installed in the image.

Change-Id: I717b4f2215054ef9135a1ac252ed26820bdcb1aa
(cherry picked from commit 1371e4fc5b)
This commit is contained in:
Michal Nasiadka 2023-01-25 16:43:25 +01:00
parent ff29af45d7
commit 055cbf6876
1 changed files with 10 additions and 9 deletions

View File

@ -17,15 +17,6 @@ COPY curlrc /root/.curlrc
ENV LANG en_US.UTF-8 ENV LANG en_US.UTF-8
{% endblock %} {% endblock %}
{# NOTE(SamYaple): Avoid uid/gid conflicts by creating each user/group up front. #}
{# Specifics required such as homedir or shell are configured within the service specific image #}
{%- for name, user in users | dictsort() %}
{% if loop.first -%}RUN {% else %} && {% endif -%}
groupadd --gid {{ user.gid }} {{ user.group }} \
&& useradd -l -M --shell /usr/sbin/nologin --uid {{ user.uid }} --gid {{ user.gid }} {{ name }}
{%- if not loop.last %} \{% endif -%}
{%- endfor %}
LABEL kolla_version="{{ kolla_version }}" LABEL kolla_version="{{ kolla_version }}"
{% import "macros.j2" as macros with context %} {% import "macros.j2" as macros with context %}
@ -203,6 +194,7 @@ RUN {{ macros.install_packages(base_centos_yum_repo_packages | customizable("cen
'socat', 'socat',
'sudo', 'sudo',
'tar', 'tar',
'util-linux',
'util-linux-user', 'util-linux-user',
'which' 'which'
] %} ] %}
@ -337,6 +329,15 @@ RUN apt-get --error-on=any update \
{# endif base_package_type deb #} {# endif base_package_type deb #}
{% endif %} {% endif %}
{# NOTE(SamYaple): Avoid uid/gid conflicts by creating each user/group up front. #}
{# Specifics required such as homedir or shell are configured within the service specific image #}
{%- for name, user in users | dictsort() %}
{% if loop.first -%}RUN {% else %} && {% endif -%}
groupadd --gid {{ user.gid }} {{ user.group }} \
&& useradd -l -M --shell /usr/sbin/nologin --uid {{ user.uid }} --gid {{ user.gid }} {{ name }}
{%- if not loop.last %} \{% endif -%}
{%- endfor %}
{% if base_distro == 'centos' %} {% if base_distro == 'centos' %}
RUN sed -ri '/-session(\s+)optional(\s+)pam_systemd.so/d' /etc/pam.d/system-auth \ RUN sed -ri '/-session(\s+)optional(\s+)pam_systemd.so/d' /etc/pam.d/system-auth \
&& sed -ri '/^[^#]/ s/systemd//g' /etc/nsswitch.conf && sed -ri '/^[^#]/ s/systemd//g' /etc/nsswitch.conf