prev create --compose starts a hosted review environment from a Compose file. One service is public over HTTP. The others stay private. Private services are reached from the public service on localhost and the port they expose. Service names do not resolve.

prev create --compose compose.yml
prev create --compose compose.yml --subdomain acme --ttl 24h

With --compose, the only other prev create flags are --subdomain, --ttl, and --output. If you omit --ttl, the preview lasts 24 hours, still within that plan’s maximum. The command prints its banner and then the preview URL. --output url prints only the URL. --output json prints the CLI preview record as JSON. Global flags such as --api-key still work.

Do not combine --compose with --image, --source, --to, --db, --db-import, credentials, an IP allowlist, a custom domain, feedback, a template, or environment flags. Put environment values in the Compose file.

Compose file

The file is a services list. Each service needs an image. The image must be pullable without signing in. A build key is rejected. Volumes and other keys inside a service are rejected. Keep the file to a services list. Other top-level sections, such as networks or volumes, are not applied and can be rejected. At most four services are allowed. Exactly one service publishes one HTTP port under ports. Other services may expose a port on the shared network. Two services cannot use the same port.

depends_on is a list of service names. A cycle is rejected, and a dependency must expose a port. If a service waits on another and the image command cannot be read, set both command and entrypoint.

environment is KEY: value. Values are literal: ${VALUE} is not expanded, and a .env file is not loaded. command and entrypoint are a string or a YAML list. Inline comments, escaped quotes, and flow sequences such as [nginx, -g] are not supported.

Example

services:
  db:
    image: postgres:16
    expose:
      - 5432
    environment:
      POSTGRES_PASSWORD: preview
  web:
    image: nginx:alpine
    ports:
      - "80"
    depends_on:
      - db
    environment:
      DATABASE_HOST: localhost

The full prev create reference is on the Commands page.