问题描述
当我在fedora容器systemctl中使用时,我得到:
When I in a fedora container systemctl use, I get:
无法获得D-Bus连接::未知错误-1
Failed to get D-Bus connection:: Unknown error -1
有人知道如何解决此问题吗?还是不能在Docker容器中使用systemctl?
Does someone know how to fix this? Or can systemctl not be used in a docker container?
推荐答案
systemctl
命令通过DBus连接与 systemd
对话.您不太可能在容器中运行 systemd
,因此 systemctl
没有什么可谈的.
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.
虽然在容器中运行 systemd
是可能,但这样做通常(但并非总是如此!)表明您需要重新考虑容器的体系结构
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.
这篇关于在fedora容器中,systemctl给出了无法获得D-Bus连接的信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!