Error during Dockerfile build concerning debian package opensearch install

Versions
Opensearch 2.6.0
openjdk:17.0.5-jre
Docker version 20.10.18

Describe the issue:
I try to build opensearch docker container by mean of my Dockerfile.
One error is detected at docker build:
/var/lib/dpkg/info/opensearch.postinst: line 56: systemd-tmpfiles: command not found
dpkg: error processing package opensearch (–configure):
installed opensearch package post-installation script subprocess returned error exit status 127.

Have you an idea about this error.
let see the part of the Dockerfile concerned, and more detailed error.

Configuration:
Part of Dockerfile:

COPY GPG-KEY-opensearch /etc/GPG-KEY-opensearch
RUN export APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn ; cat /etc/GPG-KEY-opensearch | apt-key add - &&
echo “deb https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/apt stable main” | sudo tee -a /etc/apt/sources.list.d/opensearch-2.x.list &&
apt-get update &&
apt-get install -y iproute2 libnss3-dev fonts-liberation libfontconfig1 libexpat1-dev tree opensearch &&
apt-get clean &&
rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/*

Relevant Logs or Screenshots:


Unpacking tree (1.8.0-1) …
Setting up opensearch (2.6.0) …
Running OpenSearch Post-Installation Script
/var/lib/dpkg/info/opensearch.postinst: line 56: systemd-tmpfiles: command not found
dpkg: error processing package opensearch (–configure):
installed opensearch package post-installation script subprocess returned error exit status 127
Setting up linux-libc-dev:amd64 (5.4.0-144.161) …
Setting up libnspr4:amd64 (2:4.25-1) …
Setting up libpng16-16:amd64 (1.6.37-2) …
Setting up tree (1.8.0-1) …
Setting up libmnl0:amd64 (1.0.4-2) …
Setting up ucf (3.0038+nmu1) …
Setting up libxtables12:amd64 (1.8.4-3ubuntu2) …
Setting up libcrypt-dev:amd64 (1:4.4.10-10ubuntu4) …
Setting up fonts-liberation (1:1.07.4-11) …
Setting up libc-dev-bin (2.31-0ubuntu9.9) …
Setting up libelf1:amd64 (0.176-1.1build1) …
Setting up libnspr4-dev (2:4.25-1) …
Setting up fontconfig-config (2.13.1-2ubuntu3) …
Setting up iproute2 (5.5.0-1ubuntu1) …
Setting up libnss3:amd64 (2:3.49.1-1ubuntu1.9) …
Setting up libfreetype6:amd64 (2.10.1-2ubuntu0.2) …
Setting up libnss3-dev:amd64 (2:3.49.1-1ubuntu1.9) …
Setting up libc6-dev:amd64 (2.31-0ubuntu9.9) …
Setting up libfontconfig1:amd64 (2.13.1-2ubuntu3) …
Setting up libexpat1-dev:amd64 (2.2.9-1ubuntu0.6) …
Processing triggers for libc-bin (2.31-0ubuntu9.9) …
Errors were encountered while processing:
opensearch
E: Sub-process /usr/bin/dpkg returned an error code (1)
The command ‘/bin/bash -o pipefail -c export APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn ; cat /etc/GPG-KEY-opensearch | apt-key add - && echo “deb https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/apt stable main” | sudo tee -a /etc/apt/sources.list.d/opensearch-2.x.list && apt-get update && apt-get install -y iproute2 libnss3-dev fonts-liberation libfontconfig1 libexpat1-dev tree opensearch && apt-get clean && rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/*’ returned a non-zero code: 100

I had a similar problem.
But I only solved it with a ready-made image.

OpenSearch

docker pull opensearchproject/opensearch:latest

OpenSearch Dashboards

docker pull opensearchproject/opensearch-dashboards:latest

And as written in the documentation, run the container this way:
docker run -d -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" opensearchproject/opensearch:latest

It seem’s not posible for me as i have to build a customized image corresponding to the environment of my project.

In fact the porblem appears during post-installation of the opensearch debian package as this one needs: systemd-tmpfiles . This service is not running in the built container.
Trying to install systemd package fails : System has not been booted with systemd as init system (PID 1). Can’t operate.

Is a solution possible for a next debian release avoiding systemd-tmpfiles service ?