Skip to main content
This guide shows you how to expose HTTP services from your Docker containers to the public internet with automatic HTTPS.

Prerequisites

  • A Phala Cloud account
  • A Docker image that runs an HTTP service

Step 1: Define Your Service

Create a docker-compose.yml file with port mapping:
The format is "HOST_PORT:CONTAINER_PORT", following standard Docker behavior:
  • HOST_PORT: The port number that appears in your public URL
  • CONTAINER_PORT: The port your application listens on inside the container

Step 2: Deploy Your Service

  1. Open the Phala Cloud Dashboard
  2. Click “Create CVM”
  3. Select “docker-compose.yml” deployment method
  4. Paste your configuration
  5. Add any secure environment variables if needed
  6. Click “Deploy”

Step 3: Access Your Endpoint

After deployment completes, find your endpoint in the Network tab:
Click the link to test your service. The connection is automatically secured with TLS.

Multiple Ports Per Service

A single service can expose any number of ports, just like in Docker:
This creates four public endpoints for the same service:
  • https://<app-id>-3000.dstack-prod5.phala.network
  • https://<app-id>-8080.dstack-prod5.phala.network
  • https://<app-id>-9090.dstack-prod5.phala.network
  • https://<app-id>-4000.dstack-prod5.phala.network

Multiple Services Example

You can also deploy multiple services, each with their own ports:

Health Checks

Add health checks to ensure your service is ready before receiving traffic:

Internal Communication

Services within the same deployment can communicate using service names:
The frontend can reach the API at http://api:8080 internally, while external users access it at https://<app-id>-8080.dstack-prod5.phala.network.

Zero-Trust Security

All traffic follows zero-trust principles:
  • External traffic arrives encrypted via TLS at the gateway
  • The gateway forwards it through WireGuard tunnels to your CVM
  • Only your code inside the TEE can decrypt and see the traffic
  • Not even Phala Cloud operators or you as the developer can inspect the traffic
  • The hardware-based isolation ensures complete privacy
This means your application handles sensitive data with true confidentiality. Credit cards, API keys, personal information - all remain private to your code alone.

Security Notes

  • All external traffic is encrypted with TLS
  • Internal service-to-service communication uses the Docker network
  • Don’t expose ports you don’t need public access to
  • Use secure environment variables for sensitive data

Next Steps