Skip to main content

Run a Workload on GCP

Deploy a Docker application as a dstack CVM on GCP with Intel TDX. This page covers the full workflow — from configuration to verification — including how to choose between managed and self-hosted KMS endpoints.

Prerequisites

  • A GCP project with Confidential VM quota enabled
    • Intel TDX Confidential VMs are available in select zones (for example us-central1-a)
  • gcloud CLI installed and authenticated
  • Linux host for deployment (recommended)
  • Docker installed
  • gsutil available in PATH
  • mtools (mcopy) and dosfstools (mkfs.fat) installed
  • dstack-cloud CLI installed
Why Linux + mtools + dosfstools? dstack-cloud deploy builds a shared FAT image and needs these tools in local environment.

Step 1: Configure dstack-cloud

Edit global config:
dstack-cloud uses JSON config (~/.config/dstack-cloud/config.json). Example:
Create bucket if needed:

KMS Options

For Self-hosted KMS, point services.kms_urls to your deployed KMS URL (see Run a dstack-kms CVM on GCP for how to set one up). If you run with key provider tpm/none (no external KMS), remove .env in project and remove env_file from app.json.

Step 2: Pull the OS Image

For dstack-cloud-0.6.0, download both archives:
Verify boot image file exists:
If disk.raw is missing, VM may boot-loop with UEFI Failed to load image.

Step 3: Create a Project


Step 4: Configure Project (app.json)

Update key fields in app.json:
  • gcp_config.project
  • gcp_config.zone
  • gcp_config.bucket
  • gcp_config.instance_name
Choose key provider mode:
  • External KMS mode (recommended): "key_provider": "kms"
  • No external KMS mode: "key_provider": "tpm" (or none)
Gateway options:
  • If you use dstack gateway URL routing, keep gateway_enabled: true
  • If you access service directly via VM public IP + opened port, set gateway_enabled: false

Step 5: Define Your Application

Edit docker-compose.yaml:

Step 6: (Optional) Add Environment Variables

If your app needs secrets/config, create .env:
In KMS mode, env values are encrypted client-side and only decrypted inside CVM after attestation.

Step 7: Deploy

dstack-cloud will:
  1. Prepare shared config files
  2. Upload image artifacts to GCS
  3. Create a GCP TDX Confidential VM
  4. Start VM and run compose workload
First deployment usually takes several minutes.

Step 8: Open Firewall

Open app port(s):
List firewall rules:

Step 9: Verify

Check status:
View logs:
Access app:
  • Direct VM mode (gateway_enabled=false):
  • Gateway mode (gateway_enabled=true): use URL printed in dstack-cloud status.

Managing Your Deployment


Common Issues


Next Steps