Deploying
Deploy a docker-compose stack
Run several services together — web, worker, database, cache — from your docker-compose.yml: one URL, one resource pool, one hourly price.
Updated 4 min read
If your repo has a docker-compose.yml (or compose.yaml), DployHub can run all its services together on the shared plan. When you pick the repo, tick Deploy the whole docker-compose stack and choose which service is public. If the repo only has a compose file, this is selected for you.
How it works
- Services with
build:are built from your repo; services withimage:(postgres, redis, …) are downloaded. - Services reach each other by name on a private network, e.g.
postgres://app:pass@db:5432/apporredis://cache:6379. - Only the public service gets your app's URL and HTTPS. Set its port in the wizard (we read it from
ports:orexpose:). - Your environment variables fill
${VARS}in the compose file and are passed to the services we build. - Data in named volumes (e.g. a database's data folder) survives every deploy and restart.
Example
services:
web:
build: .
ports: ["3000:3000"]
environment:
DATABASE_URL: postgres://app:${DB_PASSWORD}@db:5432/app
REDIS_URL: redis://cache:6379
depends_on: [db, cache]
db:
image: postgres:16-alpine
environment:
POSTGRES_USER: app
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes: ["pgdata:/var/lib/postgresql/data"]
cache:
image: redis:7-alpine
volumes:
pgdata: {}Add DB_PASSWORD under Environment variables before the first deploy.
Price: one pool for the whole stack
You choose vCPU, memory and storage once, and all services share them — at the same rates as single apps (₹300 per vCPU, ₹150 per GB of memory, ₹6 per GB of storage a month, billed hourly, GST extra). Stacks can go up to 4 vCPU and 8 GB of memory. For example 1 vCPU, 2 GB and 10 GB costs ₹660 a month.
What isn’t allowed on shared servers
- Host folders (
./data:/databind mounts) — use named volumes. privileged,cap_add,network_mode,pid: host, devices and other host access.- Published host ports —
ports:is only read to find the public port; everything goes through HTTPS. - More than 10 services, and compose
secrets/configs(use environment variables).
Updates, rollbacks and databases
Every push builds the services again and restarts the ones that changed — usually a few seconds' interruption for the public service, unlike single apps' zero-downtime switch. If the new version doesn't answer, the previous one is started again. You can roll back to any of the last five deploys. A database you run inside the stack has no automatic backups — export it regularly, or use a hosted database.
Related articles
- Deploy with your own DockerfileUse your own Dockerfile on DployHub for full control over the runtime: how detection works, the EXPOSE port rule, Dockerfile path and best practices.
- Persistent storage: keep files safe under /dataEach live app gets persistent storage mounted at /data. Learn what survives deploys, how to store uploads and SQLite files, and how to add more space.
- Set environment variables for your appAdd API keys, database URLs and other settings as encrypted environment variables on DployHub, then apply them with a restart or a redeploy.
- Choose vCPU, memory and storage for your appPick vCPU, memory and storage for a shared app, see the monthly price before you commit, resize later with a quick restart, or move to a dedicated server.