To run a stack that is not in the template catalogue, deploy your own Docker Compose file. Add a Docker Compose resource and paste the file, or use the Docker Compose build pack to read it from a Git repository. OnePloy deploys every service in the file and can generate URLs, usernames and passwords for you.
Two ways to deploy Compose
| Option | Where the Compose file lives | Use it when |
|---|---|---|
| Docker Compose resource | Pasted into OnePloy | You want a quick stack without a repository. |
| Docker Compose build pack | In your Git repository | The Compose file builds your own code and should deploy on push. |
How do I deploy a Compose file?
- Open a project environment and choose Add resource.
- Select Docker Compose and paste your file.
- Save. OnePloy parses the file and lists each service.
- Set a domain for every service that serves HTTP.
- Deploy.
How do I get generated URLs and passwords?
Reference special variables in the Compose file. OnePloy fills them in when the resource is created and keeps them stable afterwards:
services:
app:
image: ghcr.io/example/app:1.4.0
environment:
- SERVICE_URL_APP_3000
- APP_URL=${SERVICE_URL_APP}
- DB_USER=${SERVICE_USER_POSTGRES}
- DB_PASSWORD=${SERVICE_PASSWORD_POSTGRES}
- DB_HOST=postgres
depends_on:
- postgres
postgres:
image: postgres:16-alpine
environment:
- POSTGRES_USER=${SERVICE_USER_POSTGRES}
- POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRES}
- POSTGRES_DB=app
volumes:
- pg-data:/var/lib/postgresql/data
volumes:
pg-data:
In this example:
SERVICE_URL_APP_3000creates a URL for theappservice and routes it to container port 3000.${SERVICE_URL_APP}passes that URL to the application.SERVICE_USER_POSTGRESandSERVICE_PASSWORD_POSTGRESgenerate one username and password that both containers share.
The full list of prefixes is in Environment variables.
Default values
Use standard Compose default syntax for values the user may override later:
environment:
- TZ=${TZ:-UTC}
The variable appears in the resource’s environment variables, pre-filled with the default.
Networking between services
All services in the same Compose file share a network and reach each other by service name, such as postgres in the example above. You do not need to publish database ports.
Volumes
Named volumes and bind mounts declared in the file become persistent storage that survives redeployments. You can back them up on a schedule from the service’s storage backups page. See Persistent storage.
Tip: Pin image tags (for example postgres:16-alpine) instead of latest, so a redeploy never pulls an unexpected major version.