【问题标题】:Is it possible to use 'systemctl' in pod?是否可以在 pod 中使用“systemctl”?
【发布时间】:2019-03-17 14:25:28
【问题描述】:

我使用 dockerfile 制作了一个图像。我从我创建的图像创建了 pod。 但是发生了错误。当我得到一个 pod 的 shell 并使用“systemctl”时,我得到了一个 D-bus 错误。我该如何解决这个问题?

Failed to get D-Bus connection: Operation not permitted

【问题讨论】:

    标签: kubernetes centos7 dbus systemctl


    【解决方案1】:

    你基本上不能在 Docker 中使用systemctl,因为容器不运行systemd 守护进程。这在 Docker 本身中运行起来很棘手,并且可以使其运行的几种变通方法在 Kubernetes 中难以表达。

    您应该想出一些其他方法来运行您的流程。通常一个容器只会运行一个服务,因此你可以直接运行服务,而不是通过 systemd 单元文件启动它;你的 Dockerfile 可能会以类似的结尾

    CMD ["/usr/sbin/myserviced", "--foreground"]
    

    【讨论】:

    • --前台:无法识别的服务
    猜你喜欢
    • 2012-08-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-21
    • 1970-01-01
    • 2016-11-26
    • 2017-08-05
    • 2018-09-11
    相关资源
    最近更新 更多