Prerequisites
- A Phala Cloud account
- A Docker image that runs an HTTP service
Step 1: Define Your Service
Create adocker-compose.yml
file with port mapping:
"HOST_PORT:CONTAINER_PORT"
, following standard Docker behavior:
HOST_PORT
: The port number that appears in your public URLCONTAINER_PORT
: The port your application listens on inside the container
Step 2: Deploy Your Service
- Open the Phala Cloud Dashboard
- Click “Create CVM”
- Select “docker-compose.yml” deployment method
- Paste your configuration
- Add any secure environment variables if needed
- Click “Deploy”
Step 3: Access Your Endpoint
After deployment completes, find your endpoint in the Network tab:Multiple Ports Per Service
A single service can expose any number of ports, just like in Docker: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: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
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