safarov/freeswitch Docker Image
这是官方推出的最小化FreeSwitch Docker容器,其中FreeSwitch作为一款开源的实时通信软交换平台,具备强大的语音、视频、消息等多媒体处理能力,该容器通过精简设计实现资源占用最小化,同时保持官方认证的稳定性与兼容性,可快速部署于各类环境,为开发者和企业提供高效、便捷的实时通信服务运行载体。
About
This is minimized official FreeSwitch docker container. Container designed to run on host, bridge and swarm network. Size of container decreased to 149MB (62MB compressed) Significantly increased security:
- removed all libs except libc, busybox, tcpdump, dumpcap, freeswitch and dependent libs;
- removed 'system' API command from vanila config;
- updated FreeSwitch default SIP password to random value.
Used environment variables
SOUND_RATES- rates of sound files that must be downloaded and installed. Available values8000,16000,32000,48000. May defined multiply values using semicolon as delimiter. ExampleSOUND_RATES=8000:16000;SOUND_TYPES- types of sound files that must be downloaded and installed. Available values music,en-us-callie,en-us-allison,ru-RU-elena,en-ca-june,fr-ca-june,pt-BR-karina,sv-se-jakob,zh-cn-sinmei,zh-hk-sinmei. ExampleSOUND_TYPES=music:en-us-callie;EPMD- start epmd daemon, useful when you use mod_erlang and mod_kazoo FreeSwitch modules. Available valuestrue,false.DUMPCAP- start dumpcap daemon, useful when you need PCAP files voip troubleshooting and call monitoring. Available valuestrue,falseor any value if you want define custom options for dumpcap. When usedtruevalue, then dumpcap options is-i any -p -t -q -b duration:3600 -b files:48 -w /dumpcap/packets.pcapand PCAP files will be wrote to/dumpcapfolder of container.
Usage container
- Creating volume for sound files. This may be skipped if you not use freeswitch MOH and other sound files.
shdocker volume create --name freeswitch-sounds
- Stating container
shdocker run --net=host --name freeswitch \ -e SOUND_RATES=8000:16000 \ -e SOUND_TYPES=music:en-us-callie \ -v freeswitch-sounds:/usr/share/freeswitch/sounds \ -v /etc/freeswitch/:/etc/freeswitch \ safarov/freeswitch
systemd unit file
You can use this systemd unit files on your docker host.
Unit file can be placed to /etc/systemd/system/freeswitch-docker.service and enabled by commands
shsystemd start freeswitch-docker.service systemd enable freeswitch-docker.service
host network
sh$ cat /etc/systemd/system/freeswitch-docker.service [Unit] Description=freeswitch Container After=docker.service network-online.target Requires=docker.service [Service] Restart=always TimeoutStartSec=0 #One ExecStart/ExecStop line to prevent hitting bugs in certain systemd versions ExecStart=/bin/sh -c 'docker rm -f freeswitch; \ docker run -t --net=host --name freeswitch \ -e SOUND_RATES=8000:16000 \ -e SOUND_TYPES=music:en-us-callie \ -v freeswitch-sounds:/usr/share/freeswitch/sounds \ -v /etc/kazoo/freeswitch/:/etc/freeswitch \ freeswitch' ExecStop=-/bin/sh -c '/usr/bin/docker stop freeswitch; \ /usr/bin/docker rm -f freeswitch;' [Install] WantedBy=multi-user.target
default bridge network
sh[Unit] Description=freeswitch Container After=docker.service network-online.target Requires=docker.service [Service] Restart=always TimeoutStartSec=0 #One ExecStart/ExecStop line to prevent hitting bugs in certain systemd versions ExecStart=/bin/sh -c 'docker rm -f freeswitch; \ docker run -t --network bridge --name freeswitch \ -p 5060:5060/udp -p 5060:5060 \ -e SOUND_RATES=8000 \ -e SOUND_TYPES=music:en-us-callie \ -v freeswitch-sounds:/usr/share/freeswitch/sounds \ -v /etc/freeswitch/:/etc/freeswitch \ safarov/freeswitch' ExecStartPost=/bin/sh -c 'sleep 5; \ IP_ADDR=$(docker inspect -f "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" freeswitch); \ /sbin/iptables -A DOCKER -t nat -p udp ! -i docker0 --dport 17000:17999 -j DNAT --to $IP_ADDR:17000-17999; \ /sbin/iptables -A DOCKER -p udp ! -i docker0 -o docker0 -d $IP_ADDR --dport 17000:17999 -j ACCEPT' ExecStop=-/bin/sh -c 'IP_ADDR=$(docker inspect -f "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" freeswitch); \ /sbin/iptables -D DOCKER -t nat -p udp ! -i docker0 --dport 17000:17999 -j DNAT --to $IP_ADDR:17000-17999; \ /sbin/iptables -D DOCKER -p udp ! -i docker0 -o docker0 -d $IP_ADDR --dport 17000:17999 -j ACCEPT; \ /usr/bin/docker stop freeswitch; \ /usr/bin/docker rm -f freeswitch;' [Install] WantedBy=multi-user.target
.bashrc file
To simplify freeswitch managment you can add alias for fs_cli to .bashrc file as example bellow.
shalias fs_cli='docker exec -i -t freeswitch /usr/bin/fs_cli'
How to create custom container
This container created from scratch image by addiding required freeswitch files packaged to tar.gz archive. To create custom container:
- install required FreeSwitch packages. Now supported debian dist
shapt-get install freeswitch-conf-vanilla
- clone freeswitch repo
shgit clone https://freeswitch.org/stash/projects/FS/repos/freeswitch/browse
- execute
make_min_archive.shscript
shcd freeswitch/docker/base_image ./make_min_archive.sh
- build custom container
shdocker build -t freeswitch_custom .
Read more
https://github.com/signalwire/freeswitch/tree/master/docker/release
镜像拉取方式
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
轩辕镜像加速拉取命令点我查看更多 freeswitch 镜像标签
DockerHub 原生拉取命令
用户好评
来自真实用户的反馈,见证轩辕镜像的优质服务
