Skip to main content

Overview

Ant Media Server can be deployed using Docker containers, providing a consistent and portable deployment method across different environments. This guide covers Docker-based deployment strategies.

Prerequisites

  • Docker Engine 20.10 or later
  • Docker Compose v2.0 or later (for compose deployments)
  • At least 4GB RAM allocated to Docker
  • Ports 5080, 5443, 1935, and 5000-65000 available

Quick Start

Pull the Official Image

Ant Media Server provides official Docker images:

Run a Container

Access the web panel at http://localhost:5080

Docker Run with Advanced Configuration

With Environment Variables

With Persistent Storage

With License Key (Enterprise)

Docker Compose

Basic Docker Compose Configuration

Create a docker-compose.yml file:
Start the service:

Enterprise Edition with MongoDB

Production Setup with SSL

Volume Mounts

Important Directories

Mounting volumes ensures your data persists even if the container is removed or recreated.

Environment Variables

Available Environment Variables

Resource Limits

Configure Docker resource limits:

Container Management

Start/Stop Containers

View Logs

Execute Commands Inside Container

SSL/TLS Configuration in Docker

Using enable_ssl.sh Script

Execute the SSL script inside the running container:
Port 80 must be available for Let’s Encrypt validation. The enable_ssl.sh script checks if port 80 is in use.

Using Pre-existing Certificates

Mount your certificate files:

Cluster Mode with Docker

Multi-Node Setup

Health Checks

Add health checks to your Docker Compose:

Docker Networking

Host Network Mode

For optimal WebRTC performance, use host network mode:
Host network mode bypasses Docker’s network isolation. Use with caution and ensure firewall rules are properly configured.

Backup and Restore

Backup Configuration and Streams

Restore from Backup

Troubleshooting

Container Won’t Start

Check logs:

Port Conflicts

Find what’s using the port:

Performance Issues

Monitor container resources:

Network Connectivity

Test network from inside container:

WebRTC UDP Ports

Ensure UDP ports are properly mapped:

Production Best Practices

1

Use Named Volumes

Use Docker named volumes instead of bind mounts for better performance:
2

Set Resource Limits

Always define resource limits to prevent resource exhaustion:
3

Configure Logging

Use Docker’s logging drivers for centralized log management:
4

Use Health Checks

Implement health checks for automatic container recovery
5

Secure with SSL

Always use SSL/TLS in production environments

Next Steps