Skip to content

Commit b40cf13

Browse files
committed
fix: handle missing systemctl in Docker during package installation
- Create fake systemctl command during openspp-17-daily installation - Prevents postinst script failure in Docker containers - Remove fake systemctl after installation completes - Applied to both Ubuntu and Debian slim Dockerfiles
1 parent 5b95211 commit b40cf13

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,19 @@ COPY --from=downloader /etc/apt/keyrings/openspp.gpg /etc/apt/keyrings/
4545
COPY --from=downloader /etc/apt/sources.list.d/openspp.list /etc/apt/sources.list.d/
4646

4747
# Install ca-certificates first, then OpenSPP package from APT repository
48-
# The package and its dependencies will be automatically resolved
48+
# Create a fake systemctl to handle postinst scripts in Docker
4949
RUN apt-get update && \
5050
apt-get install -y --no-install-recommends \
5151
ca-certificates \
5252
&& apt-get update && \
53-
apt-get install -y --no-install-recommends \
53+
# Create fake systemctl for Docker installation \
54+
&& echo '#!/bin/sh\nexit 0' > /usr/bin/systemctl \
55+
&& chmod +x /usr/bin/systemctl \
56+
# Install OpenSPP package \
57+
&& apt-get install -y --no-install-recommends \
5458
openspp-17-daily \
59+
# Remove fake systemctl after installation \
60+
&& rm -f /usr/bin/systemctl \
5561
&& apt-get clean \
5662
&& rm -rf /var/lib/apt/lists/*
5763

Dockerfile.slim

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,19 @@ COPY --from=downloader /etc/apt/keyrings/openspp.gpg /etc/apt/keyrings/
4545
COPY --from=downloader /etc/apt/sources.list.d/openspp.list /etc/apt/sources.list.d/
4646

4747
# Install ca-certificates first, then OpenSPP package from APT repository
48+
# Create a fake systemctl to handle postinst scripts in Docker
4849
RUN apt-get update && \
4950
apt-get install -y --no-install-recommends \
5051
ca-certificates \
5152
&& apt-get update && \
52-
apt-get install -y --no-install-recommends \
53+
# Create fake systemctl for Docker installation \
54+
&& echo '#!/bin/sh\nexit 0' > /usr/bin/systemctl \
55+
&& chmod +x /usr/bin/systemctl \
56+
# Install OpenSPP package \
57+
&& apt-get install -y --no-install-recommends \
5358
openspp-17-daily \
59+
# Remove fake systemctl after installation \
60+
&& rm -f /usr/bin/systemctl \
5461
&& apt-get clean \
5562
&& rm -rf /var/lib/apt/lists/*
5663

0 commit comments

Comments
 (0)