在容器中运行服务(upstart / init.d) [英] Running services (upstart/init.d) in a container

查看:210
本文介绍了在容器中运行服务(upstart / init.d)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 我正在尝试在Docker中启动一个有很多初始化和启动服务的系统, initctl:无法连接到Upstart:
无法连接到socket / com / ubuntu / upstart:连接拒绝

所有的解决方法建议使用/ bin / true的硬链接来使错误无效。但是我需要这些服务由upstart管理重新启动能力,并且upstart发射事件工作...



由于看起来docker不支持这一点,考虑到编写脚本来启动/etc/rcX.d中的所有服务的总体缺陷,并跟踪PID。这不能解决从upstart发出的事件的缺乏。



任何其他想法如何在docker中启动upstart进程?

解决方案

不幸的是,upstart在docker容器中不起作用,因为它们对init系统有一些魔力。



问题解释:


如果您的应用程序使用upstart,这将不太适合裸坞站图像,如果将/ sbin / init或
/ sbin / initctl转移到/ bin / true或/ dev /
如果这个应用程序有一个旧的学校系统V initscript,并且initctl命令没有被转移
,您的应用程序可能会使用服务启动。



在ubuntu的情况下,在ubuntu上,包装使用了一个upstart
作业,没有经典的init脚本,所以它是正常的,它不会在
中启动这两种情况。


< blockquote>

这一个说:


由于Docker用自己替换了默认的/ sbin / init,所以
无法在Docker容器中运行Upstart init。



I'm trying to launch a system in docker that has many init and upstart services and I get this error.

initctl: Unable to connect to Upstart:
Failed to connect to socket /com/ubuntu/upstart: Connection refused

All the workarounds suggest making a hard link to /bin/true to silence the error. But I need to have these services managed by upstart for restart-ability and for upstart emit events to work...

As it seems docker does not support this, I'm considering the gross hack of writing a script to launch all the services in /etc/rcX.d and keep track of the PIDs. That doesn't solve lack of emit events from upstart.

Any other ideas how to launch upstart processes in docker?

解决方案

Unfortunately, upstart does not work inside of a docker container because they do some magic with the init system.

This issue explains:

If your application uses upstart, this wont fit well in bare docker images, and even more if they divert /sbin/init or /sbin/initctl to something like /bin/true or /dev/null. You application may use service to start if this one has an old school systemV initscript and if the initctl command has not been diverted.

In the case of salt-minion, on ubuntu the packaging uses an upstart job and no classical init script so it is normal that it wont start in both cases.

And this one says:

Because Docker replaces the default /sbin/init with its own, there's no way to run the Upstart init inside a Docker container.

这篇关于在容器中运行服务(upstart / init.d)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆