如何在Docker容器中管理守护程序服务
我正在Docker容器内部运行Avahi-Daemon
。目前,我通过简单地从组合文件运行它来开始此操作。有没有办法以“托管”的方式启动它,因此如果失败,它会自动重新启动?目前,由于缺乏Init过程,如果失败了,它将变得已删除,无法启动替换。
I'm running avahi-daemon
inside of a Docker container. Currently I'm starting this by simply running it from the compose file. Is there a way to start it in a "managed" fashion, so it automatically restarts if it fails? Currently, due to the lack of an init process if it fails it becomes defunct and a replacement cannot be started.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它看起来像您只需在没有
的情况下运行它 -
选项;然后,它将是一个可能是主要容器过程的前景过程。然后,您可以使用docker 如果容器失败,请重新启动容器。最小的Dockerfile看起来像:
相应的组合设置:
It looks like you can just run it without a
--daemonize
option; then it will be a foreground process that can be the main container process. You can then use a Docker restart policy to restart the container if it fails.A minimal Dockerfile could look like:
And the corresponding Compose setup: