restcomm phusion baseimage 运行sv 无法启动./运行: 文件不存在

restcomm phusion baseimage runsv unable to start ./run: file does not exist

我正在关注 Restcomm Docker Quick Start Guide。 我正在尝试在安装了 docker 的 "large" VM(8GB 内存和 4vCPU)上启动 restcomm 连接。 我在企业 http 代理后面,所以 运行ning "docker-compose up" 开箱即用是不够的。我创建了自己的 restcomm/restcomm docker 图像:我克隆了 Restcomm-Docker git 项目并做了一些更改:

我在 Docker 文件和脚本/{restcomm_autoconf.sh,restcomm_sslconf.sh} 中添加了 http_proxy 和 https_proxy ENV 指令,这样所有的 wgets 都可以工作。

我在RCBCONF_STATIC_ADDRESS.yml里配置了虚拟机ip地址在RCBCONF_STATIC_ADDRESS.

当我构建 "custom" docker 映像时,我在 apt-get 安装步骤中收到一些错误消息:

docker build -t restcomm/restcomm:latest -f Dockerfile .
...
Setting up x11-common (1:7.7+13ubuntu3) ...
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
insserv: can not remove(../rc0.d/K01hwclock.sh): No such file or directory
insserv: can not remove(../rc0.d/K01sendsigs): No such file or directory
...

所以我检查了你依赖的原始 docker 图像 (phusion/baseimage) 并找到了那些奇怪的文件:

run -it phusion/baseimage bash
root@3485dcc8fe85:/# ls -l /etc/rc0.d/
ls: cannot access '/etc/rc0.d/K01hwclock.sh': No such file or directory
ls: cannot access '/etc/rc0.d/K01sendsigs': No such file or directory
ls: cannot access '/etc/rc0.d/K02umountnfs.sh': No such file or directory
ls: cannot access '/etc/rc0.d/K03umountfs': No such file or directory
ls: cannot access '/etc/rc0.d/K04umountroot': No such file or directory
ls: cannot access '/etc/rc0.d/K05halt': No such file or directory
total 4
??????????? ? ?    ?      ?            ? K01hwclock.sh
??????????? ? ?    ?      ?            ? K01sendsigs
lrwxrwxrwx. 1 root root  19 May 17  2017 K01syslog-ng -> ../init.d/syslog-ng
lrwxrwxrwx. 1 root root  17 May 10  2017 K01urandom -> ../init.d/urandom
lrwxrwxrwx. 1 root root  20 May 17  2017 K02hwclock.sh -> ../init.d/hwclock.sh
lrwxrwxrwx. 1 root root  18 May 17  2017 K02sendsigs -> ../init.d/sendsigs
??????????? ? ?    ?      ?            ? K02umountnfs.sh
??????????? ? ?    ?      ?            ? K03umountfs
lrwxrwxrwx. 1 root root  22 May 17  2017 K03umountnfs.sh -> ../init.d/umountnfs.sh
lrwxrwxrwx. 1 root root  18 May 17  2017 K04umountfs -> ../init.d/umountfs
??????????? ? ?    ?      ?            ? K04umountroot
??????????? ? ?    ?      ?            ? K05halt
lrwxrwxrwx. 1 root root  20 May 17  2017 K05umountroot -> ../init.d/umountroot
lrwxrwxrwx. 1 root root  14 May 17  2017 K06halt -> ../init.d/halt
-rw-r--r--. 1 root root 353 Jan 19  2016 README
root@3485dcc8fe85:/#

抱歉,这可能是一个很常见的问题,但在 google 上没有发现任何明显的问题。

然后,当我 运行 docker-compose 时,我有以下错误信息:

restcomm_1  | *** Running /etc/my_init.d/restcomm6.sh...
restcomm_1  | mv: cannot remove '/etc/service/cron/run': No such file or directory
restcomm_1  | mv: cannot remove '/etc/service/sshd/down': No such file or directory
restcomm_1  | mv: cannot remove '/etc/service/sshd/run': No such file or directory
restcomm_1  | mv: cannot remove '/etc/service/syslog-forwarder/run': No such file or directory
restcomm_1  | mv: cannot remove '/etc/service/syslog-ng/run': No such file or directory

然后循环出现以下错误信息:

restcomm_1  | *** Running /etc/rc.local...
restcomm_1  | *** Booting runit daemon...
restcomm_1  | *** Runit started as PID 281
restcomm_1  | runsv syslog-ng: fatal: unable to start ./run: file does not exist
restcomm_1  | runsv syslog-forwarder: fatal: unable to start ./run: file does not exist
restcomm_1  | runsv cron: fatal: unable to start ./run: file does not exist
restcomm_1  | runsv sshd: fatal: unable to start ./run: file does not exist

我认为这与我在构建 docker 图像时遇到的问题有关,但我不是 100% 确定。

我在 Restcomm-Docker/scripts/restcomm-runlevels.sh 中发现以下行在 docker 图像中添加为 /etc/my_init.d/restcomm6.sh:

cp -pR /etc/service/* /etc/runit/runsvdir/current/

这可能是之前错误消息的来源。 它应该只添加正确的脚本吗?

编辑 1: 我在 Restcomm-Docker/scripts/restcomm-runlevels.sh 中注释掉了以下块:

#cd /etc/runit/runsvdir
#ln -s default /etc/runit/runsvdir/current
#cp -pR /etc/service/* /etc/runit/runsvdir/current/
#mv -f /etc/service /service.old && ln -s /etc/runit/runsvdir/current /etc/service

现在 restcomm 服务启动了,但我感觉某些东西启动了多次(可能是由于我的更改导致的 运行it 监控不合适?):我可以看到以下行和随后的行在不同的线程中记录块两次:

Initializing RVD. Project version: 1.13

然后以绑定异常结束:

restcomm_1  | 21:05:18,291 ERROR [org.mobicents.protocols.mgcp.stack.JainMgcpStackImpl] (RestComm-akka.actor.default-dispatcher-2) java.net.BindException: Address already in use
restcomm_1  | 21:05:18,293 ERROR [org.restcomm.connect.mrb.MediaResourceBrokerGeneric] (RestComm-akka.actor.default-dispatcher-4) Failed to find a local port 2727 to bound stack: java.lang.RuntimeException: Failed to find a local port 2727 to bound stack
restcomm_1  |   at org.mobicents.protocols.mgcp.stack.JainMgcpStackImpl.init(JainMgcpStackImpl.java:172) [mgcp-driver-6.0.23.jar:6.0.23]
restcomm_1  |   at org.mobicents.protocols.mgcp.stack.JainMgcpStackImpl.createProvider(JainMgcpStackImpl.java:250) [mgcp-driver-6.0.23.jar:6.0.23]
restcomm_1  |   at org.restcomm.connect.mrb.MediaResourceBrokerGeneric.bindMGCPStack(MediaResourceBrokerGeneric.java:134) [restcomm-connect.mrb-8.3.0-140.jar:8.3.0-140]
restcomm_1  |   at org.restcomm.connect.mrb.MediaResourceBrokerGeneric.onStartMediaResourceBroker(MediaResourceBrokerGeneric.java:120) [restcomm-connect.mrb-8.3.0-140.jar:8.3.0-140]
restcomm_1  |   at org.restcomm.connect.mrb.MediaResourceBrokerGeneric.onReceive(MediaResourceBrokerGeneric.java:99) [restcomm-connect.mrb-8.3.0-140.jar:8.3.0-140]
restcomm_1  |   at akka.actor.UntypedActor$$anonfun$receive.applyOrElse(UntypedActor.scala:159) [akka-actor_2.10-2.1.2.jar:]
restcomm_1  |   at akka.actor.ActorCell.receiveMessage(ActorCell.scala:425) [akka-actor_2.10-2.1.2.jar:]
restcomm_1  |   at akka.actor.ActorCell.invoke(ActorCell.scala:386) [akka-actor_2.10-2.1.2.jar:]
restcomm_1  |   at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230) [akka-actor_2.10-2.1.2.jar:]
restcomm_1  |   at akka.dispatch.Mailbox.run(Mailbox.scala:212) [akka-actor_2.10-2.1.2.jar:]
restcomm_1  |   at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:506) [akka-actor_2.10-2.1.2.jar:]
restcomm_1  |   at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:262) [scala-library-2.10.1.jar:]
restcomm_1  |   at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975) [scala-library-2.10.1.jar:]
restcomm_1  |   at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1478) [scala-library-2.10.1.jar:]
restcomm_1  |   at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) [scala-library-2.10.1.jar:]

我找到了问题的根源。 它与 docker /var/lib/docker 底层文件系统有关。 我有一个没有格式化 d_type 支持的 xfs 文件系统。 我将一个新卷附加到我的 (openstack) VM,使用 d_type 参数对其进行了格式化并且成功了! 实际上,如果没有这个选项,它会弄乱 phusion/baseimage,然后间接地弄乱依赖此图像的 restcomm 图像。

详情如下:

# docker info
...
Storage Driver: overlay
 Backing Filesystem: xfs
 Supports d_type: false
...
WARNING: overlay: the backing xfs filesystem is formatted without d_type support, which leads to incorrect behavior.
         Reformat the filesystem with ftype=1 to enable d_type support.
         Running without d_type support will not be supported in future releases.

这就是我发现问题的方式。 用xfs_info确认:ftype=0,应该是1

[root@yohann telestax]# xfs_info /
meta-data=/dev/vda1              isize=256    agcount=10, agsize=524224 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=5240950, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@yohann telestax]#

在 openstack 上创建了一个新卷

已将此卷附加到 运行 实例

(创建的设备是 /dev/vdb)

使用 "fdisk /dev/vdb"

创建分区

命令:n、p、1 和默认值

然后"w"写入分区table

使用正确的参数在此分区上创建一个 xfs 文件系统:

[root@yohann centos]# mkfs.xfs -n ftype=1 /dev/vdb1
meta-data=/dev/vdb1              isize=512    agcount=4, agsize=655296 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=2621184, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@yohann centos]#

在 docker 停止的情况下,挂载此文件系统:

rm -fr /var/lib/docker
mkdir /var/lib/docker
mount /dev/vdb1 /var/lib/docker/

然后,docker 信息给出了正确的详细信息:

docker info
...
Storage Driver: overlay
 Backing Filesystem: xfs
 Supports d_type: true
...
(no more warning)

已成功尝试使用基本图像:

[root@yohann centos]# docker run -it phusion/baseimage bash
Unable to find image 'phusion/baseimage:latest' locally
latest: Pulling from phusion/baseimage
22ecafbbcc4a: Pull complete
580435e0a086: Pull complete
8321ffd10031: Pull complete
08b8f28a13c2: Pull complete
2b401702069a: Pull complete
a3ed95caeb02: Pull complete
eae027dcdc0e: Pull complete
93bc98227159: Pull complete
Digest: sha256:d7507394a2e31759297a8726ac1f61e1c135b5255f8be42e7081d85b6fb3f903
Status: Downloaded newer image for phusion/baseimage:latest
root@4a3b26f2748e:/# ls -l /etc/rc0.d/
total 4
lrwxrwxrwx.  1 root root  19 May 17  2017 K01syslog-ng -> ../init.d/syslog-ng
lrwxrwxrwx.  1 root root  17 May 10  2017 K01urandom -> ../init.d/urandom
lrwxrwxrwx.  1 root root  20 May 17  2017 K02hwclock.sh -> ../init.d/hwclock.sh
lrwxrwxrwx.  1 root root  18 May 17  2017 K02sendsigs -> ../init.d/sendsigs
lrwxrwxrwx.  1 root root  22 May 17  2017 K03umountnfs.sh -> ../init.d/umountnfs.sh
lrwxrwxrwx.  1 root root  18 May 17  2017 K04umountfs -> ../init.d/umountfs
lrwxrwxrwx.  1 root root  20 May 17  2017 K05umountroot -> ../init.d/umountroot
lrwxrwxrwx.  1 root root  14 May 17  2017 K06halt -> ../init.d/halt
-rw-r--r--. 13 root root 353 Jan 19  2016 README
root@4a3b26f2748e:/# exit
[root@yohann centos]#

(不再有符号链接问题)

然后,我使用 "docker-compose up".

重建了 restcomm docker 图像并 运行 再次构建它

我用 https://myip:8443 测试过 管理员@company.com,密码:RestComm

成功了! (并且它与 HTTP 上的受污染图像无关)。