Deploy apps · 10 min
Run apps with Docker Compose
Install Docker and run one or more containers from a single compose file.
Docker Compose runs your app and everything it needs (a database, a cache) from one file, the same way on your laptop and your server.
1. Install Docker
curl -fsSL https://get.docker.com | sudo sh
sudo usermod -aG docker $USERSign out and back in so you can run docker without sudo.
2. Write a compose file
Here's an example: a web app with a PostgreSQL database.
services:
app:
image: ghcr.io/you/your-app:latest
restart: always
ports:
- "80:3000"
environment:
DATABASE_URL: postgres://app:change-me@db:5432/app
depends_on: [db]
db:
image: postgres:16
restart: always
environment:
POSTGRES_USER: app
POSTGRES_PASSWORD: change-me
POSTGRES_DB: app
volumes:
- db:/var/lib/postgresql/data
volumes:
db: {}Save it as docker-compose.yml in a folder like /opt/myapp.
3. Start it
cd /opt/myapp
docker compose up -drestart: always brings the containers back after a reboot.
Everyday commands
docker compose ps # what's running
docker compose logs -f app # follow the app's logs
docker compose pull && docker compose up -d # update to new imagesStuck? Contact us or open a support ticket from your panel.