Senate

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 CaseSolution
Web apps, APIs (HTTP/HTTPS)Use Domains tab
Databases (PostgreSQL, MySQL, Redis)Use Ports
Game servers, MQTT, custom protocolsUse 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

  1. Navigate to your service and select the Ports tab
  2. Click Add Port
  3. Configure the port mapping:

Ports tab interface

FieldDescriptionExample
Protocoltcp or udptcp
PublishedPort on the host machine6379
TargetPort inside the container6379
  1. Click Save
  2. 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: 6379Target: 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:

ServicePublishedTargetProtocol
Redis63796379tcp
PostgreSQL54325432tcp
MySQL33063306tcp
MongoDB2701727017tcp

Different Ports (Port Remapping)

Run multiple instances or avoid conflicts:

ServicePublishedTargetProtocol
Redis (dev)63806379tcp
PostgreSQL (staging)54335432tcp

UDP Services

Game servers and real-time applications often use UDP:

ServicePublishedTargetProtocol
Minecraft2556525565udp
DNS5353udp

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

On this page