Docker学习之基于CentOS7.8.2003基础镜像下nginx-rtmp-ffmpeg流服务镜像创建

文章目录

  • 基于CentOS7.8.2003基础镜像下nginx-rtmp-ffmpeg流服务镜像创建
    • Docker CentOS 镜像容器启动
        • 启动Docker Engine
        • 列出CentOS系统镜像列表
        • 拉取CentOS镜像(这里我拉取得是CentOS 7.8.2003)
        • 启动CentOS 7.8.2003镜像容器
        • 查看运行中容器并进入
        • 查看系统版本
        • 停止Docker容器
    • 安装ffmpeg
        • 准备环境
        • 安装Nux-Dextop源
        • 安装ffmpeg
        • 检查ffmpeg编码
    • 安装 nginx-rtmp
        • 安装Nginx编译需要的依赖
        • 创建data/nginx-rtmp-ffmpeg目录
        • 安装wget
        • 下载nginx安装包以及nginx-rtmp-modul模块
        • 解压安装压缩包
        • 进入nginx-1.18.0.tar.gz安装包
        • 配置模块
        • 编译并安装
        • 启动nginx
        • 访问
    • nginx-rtmp 流服务配置
        • nginx.conf 配置
          • 方式一:手动修改nginx.conf文件
          • 方式二:替换nginx.conf文件
        • 创建流媒体存储文件目录
        • 启动nginx
        • 访问
    • 保存Docker镜像并上传至Docker Hub
    • 推拉流验证
        • 下载安装OBS
        • 配置OBS
        • 下载安装VLC
        • 配置VLC
        • 推流
        • 拉流

基于CentOS7.8.2003基础镜像下nginx-rtmp-ffmpeg流服务镜像创建

Docker CentOS 镜像容器启动

启动Docker Engine
[root@VM-0-8-centos /]# systemctl start docker
列出CentOS系统镜像列表
[root@VM-0-8-centos /]# docker search centos
NAME                              DESCRIPTION                                    STARS  OFFICIAL  AUTOMATED
centos                            The official build of CentOS.                  6149    [OK]
ansible/centos7-ansible           Ansible on Centos7                             132                [OK]
consol/centos-xfce-vnc            Centos container with "headless" VNC session…  119                [OK]
jdeathe/centos-ssh                OpenSSH / Supervisor / EPEL/IUS/SCL Repos - …  115                [OK]
centos/systemd                    systemd enabled base container.                87                 [OK]
centos/mysql-57-centos7           MySQL 5.7 SQL database server                  81
imagine10255/centos6-lnmp-php56   centos6-lnmp-php56                             58                 [OK]
tutum/centos                      Simple CentOS docker image with SSH access     47
centos/postgresql-96-centos7      PostgreSQL is an advanced Object-Relational …  46
kinogmt/centos-ssh                CentOS with SSH                                29                 [OK]
pivotaldata/centos-gpdb-dev       CentOS image for GPDB development. Tag names…  12
guyton/centos6                    From official centos6 container with full up…  10                 [OK]
centos/tools                      Docker image that has systems administration…  6                  [OK]
drecom/centos-ruby                centos ruby                                    6                  [OK]
pivotaldata/centos                Base centos, freshened up a little with a Do…  5
pivotaldata/centos-gcc-toolchain  CentOS with a toolchain, but unaffiliated wi…  3
darksheer/centos                  Base Centos Image -- Updated hourly            3                  [OK]
pivotaldata/centos-mingw          Using the mingw toolchain to cross-compile t…  3
mamohr/centos-java                Oracle Java 8 Docker image based on Centos 7   3                  [OK]
mcnaughton/centos-base            centos base image                              1                  [OK]
blacklabelops/centos              CentOS Base Image! Built and Updates Daily!    1                  [OK]
indigo/centos-maven               Vanilla CentOS 7 with Oracle Java Developmen…  1                  [OK]
pivotaldata/centos6.8-dev         CentosOS 6.8 image for GPDB development        0
pivotaldata/centos7-dev           CentosOS 7 image for GPDB development          0
smartentry/centos                 centos with smartentry                         0                  [OK]
拉取CentOS镜像(这里我拉取得是CentOS 7.8.2003)
[root@VM-0-8-centos /]# docker pull centos:7.8.2003
Using default tag: latest
latest: Pulling from library/centos
3c72a8ed6814: Pull complete 
Digest: sha256:76d24f3ba3317fa945743bb3746fbaf3a0b752f10b10376960de01da70685fbd
Status: Downloaded newer image for centos:latest
docker.io/library/centos:latest
启动CentOS 7.8.2003镜像容器
[root@VM-0-8-centos /]# docker run -it -d -p 11935:1935 -p 180:80 -p 1443:443 centos:7.8.2003 bash
be7b7f9c83a79b2a8ec2cb6a2fbab5a09e1ee04e0ea587bcc25419a6ffd593b9
查看运行中容器并进入
[root@VM-0-8-centos /]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                                                                 				NAMES
34091d225d00        7e6257c9f8d8        "bash"              29 minutes ago      Up 29 minutes       0.0.0.0:180->80/tcp, 0.0.0.0:1443->443/tcp, 0.0.0.0:11935->1935/tcp   inspiring_matsumoto
[root@VM-0-8-centos /]# docker exec -it 34091d225d00 bash
查看系统版本
[root@34091d225d00 /]# cat /etc/redhat-release
CentOS Linux release 7.8.2003 (Core)
停止Docker容器
docker stop [CONTAINER ID]

安装ffmpeg

注: 此 ffmpeg 安装方式适用于CentOS 7

参考:CentOS中yum安装ffmpeg

准备环境

安装EPEL Release,因为安装需要使用其他的repo源,所以需要EPEL支持:

[root@34091d225d00 nginx-rtmp-ffmpeg]# yum install -y epel-release
	

你可能感兴趣的:(Docker,Nginx,docker,linux,centos,nginx)