1

我正在关注Restcomm Docker 快速入门指南。我正在尝试在安装了 docker 的“大型”虚拟机(8GB 内存和 4vCPU)上启动 restcomm 连接。我支持公司的 http 代理,因此开箱即用运行“docker-compose up”是不够的。我创建了自己的 restcomm/restcomm docker 映像:我克隆了 Restcomm-Docker git 项目并进行了一些更改:

我在 Dockerfile 和 scripts/{restcomm_autoconf.sh,restcomm_sslconf.sh} 中添加了 http_proxy 和 https_proxy ENV 指令,以便所有 wget 都可以工作。

我在 RCBCONF_STATIC_ADDRESS 的 Restcomm-Connect/docker-compose.yml 中配置了 VM ip 地址。

当我构建“自定义”泊坞窗图像时,我在 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:/#

对不起,这可能是一个非常常见的问题,但在谷歌上没有发现任何明显的问题。

然后,当我运行 docker-compose up 时,我收到以下错误消息:

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服务启动了,但我感觉某些东西启动了多次(可能是由于我的更改而导致的不适当的运行监控?):我可以在不同的线程中看到以下行和随后的日志块两次:

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$1.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:]
4

1 回答 1

1

我发现问题出在哪里。它与 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”写入分区表

使用正确的参数在此分区上创建 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 info 给出了正确的细节:

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

成功尝试使用 baseimage:

[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]#

(没有更多的符号链接问题)

然后,我重建了 restcomm docker 映像并使用“docker-compose up”再次运行它。

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

它奏效了!(并且它与 http 上的污染图像无关)。

于 2018-01-05T17:34:05.970 回答