<p>I have a docker containter based on centos/systemd. I run the container with</p>

<p><code>docker run -d --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro &lt;image&gt;</code></p>

<p>Then  i can access the container with:</p>

<p><code>docker exec -ti &lt;containerID&gt; /bin/bash</code></p>

<p>Then i can list all loaded units with the command <code>systemctl</code> . This works fine.</p>

<p>Now i want to deploy the image into a kubernetes cluster, this works also fine and i can access the running pod in the cluster via <code>kubectl exec -ti &lt;pod&gt; /bin/bash</code></p>

<p>If i type now the command <code>systemctl</code> i get the error message </p>

<blockquote>
  <p>Failed to get D-Bus connection: Operation not permitted</p>
</blockquote>

<p>How is it possible to make systemd/systemctl available in the pod?</p>

<p><strong>HINT:</strong> Need systemd because of software running inside container, so supervisord is not an option here</p>

bucky
<p>It is a sad observation that the old proposal from Daniel Walsh (Redhat) is still floating around - which includes a hint to run a "privileged container" to get some systemd behaviour, by basically talking to the daemon outside of the container.</p>

<p>Drop that. Just forget it. You can't get that in a real cluster unless violating its basic designs.</p>

<p>And in most cases, the requirement for systemd in a container is not very strict when looking closer. There are quite a number of service-manager or an init-daemon implmentations for containers. You could try with the <a href="https://github.com/gdraheim/docker-systemctl-replacement" rel="nofollow noreferrer">docker-systemctl-replacement</a> script for example.</p>
