I am trying to bring up continuous integration pipeline and that requires me to apt install an abc.deb file inside container.

The debian/control file do include:

Depends:  ${python3:Depends}, ${misc:Depends}, python3-webpy, systemd

The debian/rules file include(only relevant part showcased below):

dh $@  --with=python3,systemd

    dh_systemd_start -p<application>


My Dockerfile looks like:

FROM <relevant base image>
COPY results/*.deb /packages/
RUN export DEBIAN_FRONTEND=noninteractive  && apt-get update && \
    apt-get install -y --no-install-recommends --auto-remove \
    dumb-init \
    procps \
    /packages/*.deb && \
    apt-get autoremove -y && \
    apt-get autoclean -y && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/cache/apt
    CMD tail -f /dev/null

When I docker exec inside the docker and do ps aux, I get:

root         1  0.0  0.0   2388   756 ?        Ss   11:51   0:00 /bin/sh -c tail -f /dev/null

How can I have systemd as PID 1 ? ever per say dumb-init!

I tried looking to multiple articles, appears that it isn't possible, requires confirmation on same. The good ones are (to name few):



  • What, specifically, are you trying to run inside the container? It's generally best practice to run a single process (or a small set of closely-related processes) so something like systemd is often not needed. Nov 26, 2019 at 14:48
  • 1
    The title and the tail end of your question talk about PID 1 & systemd, but the first 80% of your question goes on to talk about installing a particular package. Is your question about some trouble with the package installation? If not, consider removing that portion from the question. As-is, you've demonstrated that your dockerfile has the intended result -- the "CMD" is running.
    – Jeff Schaller
    Nov 26, 2019 at 16:24
  • 1
    Most Docker images are designed for a single process, so there is no need for a process manager. There are systemd Docker base images, have you tried using one of those? Running systemd inside Docker usually needs some additional configurations such as sharing the host's CGroups and making sure the required tmpfs filesystems are available (/run and /tmp IIRC). Nov 26, 2019 at 23:01

1 Answer 1


As GracefulRestart mentioned in the comment, you can build from systemd base image. For example, centos-systemd. But it's definitely not recommended to use systemd inside a docker container. Take a look at my related question.

If you need systemd only to meet dependencies, the better way is to ignore deb dependency.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .