Ports
Expose TCP/UDP services directly on the host machine
Ports
Expose container ports directly on your host machine for TCP/UDP services like databases, game servers, and other non-HTTP applications.
When to Use Ports
| Use Case | Solution |
|---|---|
| Web apps, APIs (HTTP/HTTPS) | Use Domains tab |
| Databases (PostgreSQL, MySQL, Redis) | Use Ports |
| Game servers, MQTT, custom protocols | Use Ports |
For HTTP/HTTPS traffic, configure a domain in the Domains tab instead. Senate will automatically handle SSL certificates and reverse proxy routing.
Adding a Port Binding
- Navigate to your service and select the Ports tab
- Click Add Port
- Configure the port mapping:

| Field | Description | Example |
|---|---|---|
| Protocol | tcp or udp | tcp |
| Published | Port on the host machine | 6379 |
| Target | Port inside the container | 6379 |
- Click Save
- Redeploy the service to apply changes
Port changes require a redeploy to take effect. The service will restart during deployment.
How It Works
┌─────────────────────────────────────────────────────┐
│ Host Machine │
│ │
│ External Traffic │
│ │ │
│ ▼ │
│ ┌─────────┐ ┌──────────────────────────┐ │
│ │ :6379 │ ───▶ │ Container │ │
│ │ (host) │ │ ┌──────────────────┐ │ │
│ └─────────┘ │ │ Redis on :6379 │ │ │
│ │ └──────────────────┘ │ │
│ └──────────────────────────┘ │
└─────────────────────────────────────────────────────┘When you configure Published: 6379 → Target: 6379:
- External clients connect to
your-server:6379 - Docker forwards traffic to the container's port
6379
Common Configurations
Same Port (Direct Mapping)
Most services use the same port internally and externally:
| Service | Published | Target | Protocol |
|---|---|---|---|
| Redis | 6379 | 6379 | tcp |
| PostgreSQL | 5432 | 5432 | tcp |
| MySQL | 3306 | 3306 | tcp |
| MongoDB | 27017 | 27017 | tcp |
Different Ports (Port Remapping)
Run multiple instances or avoid conflicts:
| Service | Published | Target | Protocol |
|---|---|---|---|
| Redis (dev) | 6380 | 6379 | tcp |
| PostgreSQL (staging) | 5433 | 5432 | tcp |
UDP Services
Game servers and real-time applications often use UDP:
| Service | Published | Target | Protocol |
|---|---|---|---|
| Minecraft | 25565 | 25565 | udp |
| DNS | 53 | 53 | udp |
Security Considerations
Exposed ports are accessible from the internet. Always configure authentication and consider firewall rules.
Best practices:
- Use strong passwords for databases
- Restrict access via firewall (e.g.,
ufw, security groups) - Consider SSH tunneling for sensitive services instead of public exposure
Compose Services
For Docker Compose services, port bindings are defined in your docker-compose.yml file. The Ports tab shows configured ports in read-only mode.
services:
redis:
image: redis:alpine
ports:
- "6379:6379" # Published:Target