Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Step 3: Networking

Configure how your container exposes services and handles network traffic.

Quick Port Selection

Choose from commonly used ports for rapid setup:

Web Services

  • HTTP (80/TCP): Standard web traffic
  • HTTPS (443/TCP): Secure web traffic
  • Alt HTTP (8080/TCP): Alternative HTTP port

Development Frameworks

  • React/Node (3000/TCP): Development servers
  • Flask/API (5000/TCP): Python Flask applications
  • Django/API (8000/TCP): Django development server

Databases & Services

  • Admin/Mgmt (9000/TCP): Management interfaces
  • Redis (6379/TCP): Redis database
  • PostgreSQL (5432/TCP): PostgreSQL database
  • MySQL (3306/TCP): MySQL database

Custom Port Configuration

For applications requiring specific ports:

  1. Add Custom Port: Click "Add custom ports for your specific requirements"
  2. Port Number: Enter port (1-65535)
  3. Protocol: Select TCP or UDP
  4. Purpose: Document the port's function

Configured Ports

The Configured Ports section shows all ports that will be exposed:

  • Port mapping: Internal container port to external access
  • Protocol: TCP/UDP specification
  • Status: Configuration validation

Network Information & Security

Port Configuration Tips

  • Ports 1-1023: Reserved for system services
  • Ports 8000+: Recommended for custom applications
  • TCP: Use for reliable connections (HTTP, databases)
  • UDP: Use for fast, connectionless protocols

Security Considerations

  • Only expose ports that your application actively uses
  • Use HTTPS (443) for production web applications
  • Consider using non-standard ports for additional security

Common Port Configurations

Web Applications

HTTP: 80/TCP (public web traffic)
HTTPS: 443/TCP (secure web traffic)
Admin: 9000/TCP (management interface)

API Services

API: 8000/TCP (REST API endpoint)
Health: 8080/TCP (health check endpoint)
Metrics: 9090/TCP (monitoring metrics)

Database Services

PostgreSQL: 5432/TCP
Redis: 6379/TCP
MySQL: 3306/TCP
MongoDB: 27017/TCP

Development Services

React Dev: 3000/TCP
Node.js: 3000/TCP
Flask: 5000/TCP
Django: 8000/TCP
Rails: 3000/TCP

Protocol Selection

TCP (Transmission Control Protocol)

Use Cases:

  • Web servers (HTTP/HTTPS)
  • Database connections
  • API endpoints
  • File transfers
  • Any service requiring reliable data delivery

Characteristics:

  • Reliable, ordered data delivery
  • Connection-oriented
  • Error checking and recovery
  • Flow control

UDP (User Datagram Protocol)

Use Cases:

  • Real-time applications (gaming, video streaming)
  • DNS queries
  • DHCP
  • Simple network protocols
  • Applications prioritizing speed over reliability

Characteristics:

  • Fast, connectionless
  • No guaranteed delivery
  • No error recovery
  • Minimal overhead

Network Security Best Practices

Minimal Exposure

  • Principle of Least Privilege: Only expose necessary ports
  • Service Segmentation: Separate public and internal services
  • Port Documentation: Document the purpose of each exposed port

Production Considerations

  • TLS/SSL: Use encrypted connections for sensitive data
  • Load Balancing: Distribute traffic across multiple instances
  • Rate Limiting: Implement traffic controls to prevent abuse
  • Monitoring: Track network traffic and connection patterns

Development vs Production

  • Development: May expose debug ports and development servers
  • Staging: Mirror production configuration closely
  • Production: Minimal, security-focused port exposure

Troubleshooting Network Issues

Common Problems

  • Port Conflicts: Multiple services trying to use the same port
  • Firewall Rules: Network policies blocking traffic
  • Service Discovery: Containers unable to find each other
  • Load Balancer: Incorrect routing configuration

Diagnostic Steps

  1. Verify port configuration matches application expectations
  2. Check container logs for binding errors
  3. Test connectivity from within the cluster
  4. Validate external access through load balancers

Next: Proceed to Step 4 to configure environment variables and application settings.