gpt4 book ai didi

docker - 在 Docker 容器中运行 dbus-daemon

转载 作者:行者123 更新时间:2023-12-04 17:44:01 26 4
gpt4 key购买 nike

我正在尝试创建一个内部运行自定义 D-Bus 总线的 Docker 容器。

我按如下方式配置了我的 Dockerfile:

FROM ubuntu:16.04
COPY myCustomDbus.conf /etc/dbus-1/
RUN apt-get update && apt-get install -y dbus
RUN dbus-daemon --config-file=/etc/dbus-1/myCustomDbus.conf

构建后,套接字已创建,但被标记为 as "file", not as "socket" ,而且我不能把它当作巴士使用...
-rwxrwxrwx  1 root root    0 Mar 20 07:25 myCustomDbus.sock

如果我删除此文件并运行 dbus-daemon在终端中再次命令,套接字已成功创建:
srwxrwxrwx  1 root root    0 Mar 20 07:35 myCustomDbus.sock

我不确定这是 D-Bus 问题还是 docker 问题。

最佳答案

您应该使用“ENTRYPOINT”来运行启动脚本,而不是使用“RUN”命令。

Dockerfile 应如下所示:

FROM ubuntu:14.04
COPY myCustomDbus.conf /etc/dbus-1/
COPY run.sh /etc/init/
RUN apt-get update && apt-get install -y dbus
ENTRYPOINT ["/etc/init/run.sh"]

并运行.sh:
#!/bin/bash
dbus-daemon --config-file=/etc/dbus-1/myCustomDbus.conf --print-address

关于docker - 在 Docker 容器中运行 dbus-daemon,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42898262/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com