Build a FreeSWITCH Docker Image
A FreeSWITCH image should be reproducible, minimal, and explicit about compiled modules. Pin the source or package version and separate build dependencies from the runtime image.
Use a multi-stage build: compile FreeSWITCH and required codecs in the builder stage, then copy only runtime libraries, modules, sounds, and binaries into the final image. Run as a non-root user where practical.
Mount configuration, recordings, certificates, and persistent databases deliberately rather than hiding important state inside the container filesystem.
SIP signaling commonly uses ports such as 5060 and 5080, while RTP requires a configured UDP range. Publishing only the SIP port is not enough for two-way audio. Ensure the container, host firewall, cloud security group, NAT, and FreeSWITCH external IP settings agree on the RTP range.
For production, avoid host networking unless justified, protect the event socket and management interfaces, rate-limit unauthenticated traffic, monitor registrations and call quality, and test one-way-audio, codec negotiation, and NAT traversal from external networks.