OpenMCU:先跑起来之docker



0x00.简介

项目地址:https://github.com/muggot/openmcu.git

0x01.部署环境

宿主机环境为CentOS7-x86_64-Minimal2003

0x02.部署docker

docker官方
https://docs.docker.com/engine/install/
菜鸟教程
https://www.runoob.com/docker/centos-docker-install.html
阿里教程
https://developer.aliyun.com/article/110806
https://yq.aliyun.com/articles/626118

1.防火墙配置

在实验环境中可以选择直接禁用防火墙,但是在生产环境中根据实际的需求进行规则的配置。
关闭firewalld
在CentOS7上面防火墙是firewalld服务,停止并且禁止开机启动firewalld.service

systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service

关闭 selinux

setenforce 0
getenforce
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinux
grep SELINUX=disabled /etc/sysconfig/selinux

2.卸载旧的版本

yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine -y 

3.脚本安装docker

脚本安装,阿里云源

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

注册docker开机启动

systemctl start docker
systemctl status docker
systemctl enable docker
systemctl list-unit-files |grep docker.service
docker version

4.配置Docker加速

快速配置

cat > /etc/docker/daemon.json <<EOF
{
    "registry-mirrors":["https://docker.mirrors.ustc.edu.cn/"]
}
EOF

重新启动加载配置环境

systemctl daemon-reload
docker info
systemctl restart docker
systemctl status docker

详细配置情况如下

touch /etc/docker/daemon.json
vi /etc/docker/daemon.json
{
    "registry-mirrors":["https://docker.mirrors.ustc.edu.cn/"]
}

至此,docker安装完成。

0x03.镜像获取:OpenMCU

方法1.Dockerhub拉取

搜索镜像

docker search openmcu
[root@host ~]# docker search openmcu
NAME                     DESCRIPTION                          STARS               OFFICIAL            AUTOMATED
donfanning/openmcu-ru                                         1
johannrichard/openmcu    Video conference server OpenMCU-ru   0                                       [OK]
kap0ng/openmcu_core      OpenMCU-ru build                     0
videoswitch/openmcu-ru                                        0
kap0ng/openmcu_api                                            0
[root@host ~]#

拉取镜像,镜像地址为:
https://registry.hub.docker.com/search?q=openmcu&type=image
https://registry.hub.docker.com/r/videoswitch/openmcu-ru

docker pull videoswitch/openmcu-ru:4.1.13

确定pull完成,查看本机docker镜像列表情况

docker images

方法2.手动构建镜像

git clone https://github.com/muggot/openmcu.git
cd openmcu/Docker/openmcu-ru/
ls 

这里有2个dockerfile分别使用不同的容器内部环境,分别为:ubuntu:14.04和centos:7

  • 文件1:centos-7的Dockerfile
FROM centos:7

# fail if build with libvpx > 1.5

ENV NASM_VER="2.13.01" \
 MCU_CONF_OPTS="--enable-static --disable-v4l --disable-v4l2" \
 FFMPEG_VER="4.3" \
 LIBVPX_VER="1.5.0"

RUN mkdir -p /tmp/build \
 && cd /tmp/build \
 && yum install -y wget bzip2 which freetype-devel freetype \
 kernel-devel gcc gcc-c++ make patch git flex bison autoconf automake pkgconfig \
 rpm-build libtool libtool-ltdl-devel openssl-devel \
 && wget http://www.nasm.us/pub/nasm/releasebuilds/${NASM_VER}/nasm-${NASM_VER}.tar.xz \
 && tar -xvf ./nasm-${NASM_VER}.tar.xz \
 && cd nasm-${NASM_VER} \
 && ./configure && make && make install && cd .. \
 && git clone https://code.videolan.org/videolan/x264.git ./x264 \
 && cd ./x264 \
 && ./configure --enable-shared && make && make install && cd .. \
 && wget https://github.com/webmproject/libvpx/archive/v${LIBVPX_VER}.tar.gz \
 && tar -xzf v${LIBVPX_VER}.tar.gz \
 && cd libvpx-${LIBVPX_VER} \
 && ./configure --enable-shared && make && make install && cd .. \
 && wget http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VER}.tar.gz \
 && tar xvfz ./ffmpeg-${FFMPEG_VER}.tar.gz \
 && cd ./ffmpeg-${FFMPEG_VER} \
 && ./configure --enable-libx264 --enable-libvpx --enable-gpl --disable-static --enable-shared \
 && make -j 3 && make install && cd .. \
 && git clone git://github.com/muggot/openmcu.git ./openmcu-ru \
 && cd ./openmcu-ru \
 && ./autogen.sh && ./configure $MCU_CONF_OPTS && make -j 3 && make install \
 && rm -rf /tmp/* \
 && yum remove -y wget bzip2 which git freetype-devel flex bison autoconf automake pkgconfig \
 rpm-build libtool libtool-ltdl-devel openssl-devel \
 && yum clean all || echo "not all clean" \
 && rm -rf /var/cache/yum
 
 EXPOSE 5060 5061 1420 1554 1720

CMD ["/opt/openmcu-ru/bin/openmcu-ru", "-x"]
 
  • 文件2:ubuntu-14的Dockerfile
FROM ubuntu:14.04

# Install dependenties

ENV MAKE_OPTS="-j 3"
ENV PREFIX="/opt"

RUN apt-get update \
 && apt-get install -y \
 build-essential libssl-dev flex bison autoconf automake pkg-config \
 libfreetype6-dev libjpeg62-dev md5deep libtool libavformat-dev libvpx-dev \
 libavcodec-dev libavutil-dev libswscale-dev libsamplerate0-dev git wget \
 && cd /tmp && export PATH=$PREFIX/bin:$PATH \
 && echo "--------YASM---------" \
 && wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz \
 && tar xvfz ./yasm-1.2.0.tar.gz && mv ./yasm-1.2.0 ./yasm && rm ./yasm-1.2.0.tar.gz \
 && cd /tmp/yasm && ./configure --prefix=$PREFIX \
 && make $MAKE_OPTS && make install \
 && echo "--------SOFIA-SIP---------" \
 && cd .. && wget https://videoswitch.ru/public/dependencies/stable/sofia-sip-1.12.11.tar.gz \
 && tar xvfz ./sofia-sip-1.12.11.tar.gz && mv ./sofia-sip-1.12.11 ./sofia-sip && rm ./sofia-sip-1.12.11.tar.gz \
 && cd /tmp/sofia-sip && ./configure --prefix=$PREFIX \
 && make $MAKE_OPTS && make install \
 && echo "--------OPUS---------" \
 && cd .. && wget https://videoswitch.ru/public/dependencies/stable/opus-1.1.tar.gz \
 && tar xvfz ./opus-1.1.tar.gz && mv ./opus-1.1 ./libopus && rm ./opus-1.1.tar.gz \
 && cd /tmp/libopus && ./configure --enable-shared --prefix=$PREFIX \
 && make clean && make $MAKE_OPTS && make install \
 && echo "--------LIBVPX---------" \
 && cd .. && wget https://videoswitch.ru/public/dependencies/stable/libvpx-v1.1.0.tar.bz2 \
 && tar xvfj ./libvpx-v1.1.0.tar.bz2 && mv ./libvpx-v1.1.0 ./libvpx && rm ./libvpx-v1.1.0.tar.bz2 \
 && cd /tmp/libvpx && ./configure --prefix=$PREFIX --enable-shared \
 && make clean && make $MAKE_OPTS && make install \
 && echo "--------X264---------" \
 && cd .. && git clone git://git.videolan.org/x264.git ./x264 \
 && cd /tmp/x264 && ./configure --prefix=$PREFIX --enable-shared \
 && make clean && make $MAKE_OPTS && make install \
 &&  echo "--------FFMPEG---------" \
 && cd .. && wget https://videoswitch.ru/public/dependencies/stable/ffmpeg-0.10.4.tar.gz \
 && tar xvfz ./ffmpeg-0.10.4.tar.gz && mv ./ffmpeg-0.10.4 ./ffmpeg && rm ./ffmpeg-0.10.4.tar.gz && cd /tmp/ffmpeg \
 && ./configure --enable-libx264 --enable-libvpx --enable-gpl --disable-static \
 --enable-shared --prefix=$PREFIX --extra-cflags=-I$PREFIX/include/ --extra-ldflags=-L$PREFIX/lib/ \
 && make clean && make $MAKE_OPTS && make install \
 && rm -rf /tmp/* && rm -rf /var/cache/apt/*

RUN echo "--------Install OPENMCU---------" \
 && cd /tmp && git clone git://github.com/muggot/openmcu.git ./openmcu-ru \
 && cd /tmp/openmcu-ru \
 && ./autogen.sh \
 && ./configure \
 && make && make install \
 && rm -rf /tmp/* 

EXPOSE 5060 5061 1420 1554 1720
CMD ["/opt/openmcu-ru/bin/openmcu-ru"]

下面使用的是centos-7的Dockerfile

cd openmcu/Docker/openmcu-ru/centos-7/
ls
docker build -t openmcu-centos:4.2.1 . 

构建完成,需要漫长的等待。。。。。。

Dockerfile构建参考链接:https://www.runoob.com/docker/docker-dockerfile.html

确定构建完成,查看本机docker镜像列表情况

docker images
[root@host ~]# docker images
REPOSITORY               TAG                 IMAGE ID            CREATED             SIZE
openmcu-centos           4.2.1               75c271f16af4        12 hours ago        227MB
centos                   7                   7e6257c9f8d8        2 months ago        203MB
videoswitch/openmcu-ru   4.1.13              9ccc0f2bf6e6        9 months ago        718MB
[root@host ~]# 

0x04.运行docker容器

运行容器

docker run --name openmcu-centos -p 5060:5060 -p 5061:5061 -p 1420:1420 -p 1554:1554 -p 1720:1720 -t openmcu-centos:4.2.1

如果需要后台运行,

docker run -d --name openmcu-centos -p 5060:5060 -p 5061:5061 -p 1420:1420 -p 1554:1554 -p 1720:1720 -t openmcu-centos:4.2.1

关于docker清理https://www.cnblogs.com/lijianming180/p/12347529.html

查看容器使用的宿主机端口是否被打开

netstat -lntp

0x05.访问页面

http://ip:1420

Welcome
在这里插入图片描述
Status
在这里插入图片描述
Control
在这里插入图片描述
Records
在这里插入图片描述
Settings
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

北观止

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值