sipp ffmpeg - 1 - 使用docker创建一个可以运行sipp的环境
基础镜像构建(包含sipp ffmpeg)
使用3.16版本,ffmpeg rpt 打流支持设置本地ip地址 localaddr
# Base images 基础镜像
FROM alpine:3.16
#MAINTAINER 维护者信息
MAINTAINER liyanbin
RUN alpine_version=`cat /etc/issue | head -1 | awk '{print $5}'` \
&& echo "https://mirrors.aliyun.com/alpine/v${alpine_version}/main/" > /etc/apk/repositories \
&& echo "https://mirrors.aliyun.com/alpine/v${alpine_version}/community/" >> /etc/apk/repositories \
&& apk update && apk upgrade && apk add --no-cache bash bash-doc bash-completion sipp yasm ffmpeg \
&& rm -rf /var/cache/apk/*
CMD ["/bin/bash"]
执行如下命令编译:
docker build -t sipp-os .
导出镜像
docker save sipp-os:3.16 -o sipp-os-image.tar
容器运行文件docker-compose.yml
sipp-inv/dk-compose:
- docker-compose.yml:
version: "3"
services:
sipp:
image: sipp-os:3.16
container_name: ${CONTINER_NAME}
restart: always
network_mode: host
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "1"
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
- ${SIPP_SRC_PATH}:/home/sipp
# command: /bin/bash -c "cd /home/sipp/ && bash -x run.sh"
command: /bin/bash -c "while true; do sleep 1m; done"
privileged: true
env_file:
- .env
创建运行容器
结构如下:
$ ls -a
. .. docker-compose.yml .env uac
编辑.env设置env变量:
CONTINER_NAME=sipp-uac
SIPP_SRC_PATH=/data/test/docker-sipp/src
执行如下命令创建和运行容器:
docker-compose -f docker-compose.yml -p sipp-uac up -d --force-recreate --remove-orphans
进入容器:
docker exec -it sipp-uac bash
本文来自博客园,作者:LiYanbin,转载请注明原文链接:https://www.cnblogs.com/stellar-liyanbin/p/18188033