Sunday, September 4, 2022

[SOLVED] In fedora container systemctl gives Failed to get D-Bus connection

Issue

When I in a fedora container systemctl use, I get:

Failed to get D-Bus connection:: Unknown error -1

Does someone know how to fix this? Or can systemctl not be used in a docker container?


Solution

The systemctl command talks to systemd over a DBus connection. It is unlikely that you are running systemd in your container, so systemctl has nothing with which to talk.

While it is possible to run systemd in a container, doing so is often (but not always!) a sign that you need to rethink the architecture of your containers.



Answered By - larsks
Answer Checked By - Marilyn (WPSolving Volunteer)