docker工人“无法find替代telinit实现产卵”

我是MAC用户,在VM“ubuntu 14.04”中安装了docker。 (我手动安装了所有东西, 使用docker工具箱)

问题是当我启动特定的容器(其他容器正常运行),它给了我这个奇怪的错误消息“ 找不到一个替代telinit实现产卵 ”。

这里是我用来构build图像的Dockerfile:

FROM diegomarangoni/hhvm:cli # install php composer. # It needs git and the PHP zip extension # zlib1g-dev is needed to compile the PHP zip extension # openssh-client provides ssh-keyscan RUN apt-get update \ && apt-get install --assume-yes --no-install-recommends curl git zlib1g-dev openssh-client \ && apt-get clean && rm -r /var/lib/apt/lists/* \ && curl -sS https://getcomposer.org/installer -o installer \ && hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 installer \ && mv composer.phar /usr/local/bin/composer \ && rm installer WORKDIR /home/assert/scripts COPY scripts/composer.json /home/assert/ COPY scripts /home/assert/scripts RUN hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false \ /usr/local/bin/composer install # Run the assert container web server CMD ["hhvm", "-v", "Eval.Jit=false", "/home/assert/scripts/vendor/bin/phpunit", "/home/assert/scripts/tests", "--configuration", "/home/assert/scripts/tests/phpunit.xml"] # keep it running CMD /sbin/init 

我用命令启动它:

 docker run <CONTAINER> 

提前致谢,

根据你的版本,这里可能会有一些事情发生。 你有没有试过Dan Walsh的旧post? http://developers.redhat.com/blog/2014/05/05/running-systemd-within-docker-container/

在较早的版本中,这可能是因为Docker需要做两个要求systemd:

  1. 需要使用–privileged运行
  2. 需要包含卷/ sys / fs / cgroup

如果你直截了当,你可能会发现:

 ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0 lstat("/run/systemd/system/", 0x7fffa5b4e300) = -1 ENOENT (No such file or directory) execve("/lib/sysvinit/telinit", ["/usr/sbin/init"], [/* 8 vars */]) = -1 ENOENT (No such file or directory) writev(2, [{"Couldn't find an alternative tel"..., 61}, {"\n", 1}], 2Couldn't find an alternative telinit implementation to spawn. ) = 62 exit_group(1) = ? +++ exited with 1 +++ 

请注意,沿着“init”和“telinit”这一行的某处变成了常见的符号链接,令人沮丧。 更令人困惑的是,这是一个基于红帽的发行版(CentOS),其传统的后备应该是Upstart,而不是SystemV。 在任何情况下,直接调用它是有帮助的:直接使用systemd二进制文件,而不是/ usr / sbin / init希望它是systemd二进制文件的符号链接。

在现代版本中,我尝试使用符号链接来使事情正确,但是find最好的方法实际上只是稍微改变一下运行命令。

 docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro [image] /bin/bash 

一旦你到达那里,直接运行systemd是完全正确的:

 /usr/lib/systemd/systemd --system --unit=basic.target 

这是我如何看到它与下面的systemd版本:

 Name : systemd Arch : x86_64 Version : 219 Release : 19.el7_2.12 Size : 5.1 M 

希望这可以帮助。 大量的旧文件,并改变系统规格。 JohnnyB