When to use Compose
Use the Docker Compose build pack when your app needs multiple services running together:- A web app with a database and Redis cache
- A backend API with a background worker
- A microservices stack with shared networking
Set up your Compose file
Your repository needs adocker-compose.yml (or compose.yml) at the root. Here’s a typical structure:
Deploy with Compose
Select the Compose build pack
When adding an app, choose Docker Compose as the build pack. Nixopus detects your
docker-compose.yml and parses the service definitions.Configure environment variables
Add any variables your services reference (like
DB_PASSWORD above). These are injected into the Compose environment at runtime.See environment variables for details on build vs runtime variables.Service networking
All services in a Compose deployment share a Docker network. Services reference each other by name —db, redis, web — exactly as defined in your Compose file.
Only services with explicit
ports mappings are exposed externally. Internal services (databases, caches) stay private within the Docker network.Port mapping
Nixopus routes external traffic to the port you configure for your app. Make sure your main service exposes the correct port in theports section of your Compose file.
If your Compose file has multiple services with exposed ports, Nixopus routes to the primary service — the one you designate when creating the app.
Environment variables per service
Variables set in the Nixopus dashboard are available to all services via Compose’senvironment or env_file directives. To scope a variable to a specific service, reference it in that service’s environment block.