How to Deploy a Docker Compose File on a VPS (with a Domain and HTTPS)
If you want to deploy a Docker Compose file on a VPS, here's the short answer: rent a small Linux server, install Dokploy on it, create a Compose service, paste your docker-compose.yml, add your domain, and click Deploy. Dokploy runs docker compose for you, puts your app behind a reverse proxy, and gets it a Let's Encrypt certificate. You never write an nginx config or run certbot.
I'll go step by step, for someone who has never deployed anything to a server. Then I'll show the easier way, where I asked Claude to check my Compose file for me.
What you need
- A VPS. Dokploy asks for at least 2 GB of RAM and 30 GB of disk. That covers Dokploy plus a small app and its database. Hetzner, DigitalOcean, Hostinger and others all work. If you searched "hetzner deploy docker", a Hetzner box running Ubuntu is exactly right. Pick Ubuntu or Debian.
- A domain you can add a DNS record to. You need it for HTTPS.
- Your Compose file. In a Git repo, or just as text you can paste.
Step 1: Install Dokploy
SSH into your server and run Dokploy's install script:
curl -sSL https://dokploy.com/install.sh | sh
Ports 80, 443 and 3000 must be free first, or the install fails. When it finishes, open http://your-server-ip:3000 and create your admin account.
Step 2: Make your Compose file ready for a server
Most Compose files work as they are. Three small changes make them work well behind Dokploy, and all three come from Dokploy's own docs:
- Use
expose, notports.ports: - "3000:3000"publishes the app straight to the internet on the server's IP, skipping HTTPS.expose: - 3000keeps it on the internal network, and Dokploy's proxy (Traefik) sends your domain's traffic to it. - Remove
container_name. Dokploy's docs say it "will cause issues with logs, metrics and other features." - Use variables for secrets. Write
${DB_PASSWORD}in the file and put the real value in Dokploy's Environment tab. Your secrets stay out of Git.
Here's the file I'll use as the example. It's Umami (simple web analytics) with its Postgres database, but the shape is the same for any app plus a database:
services:
umami:
image: ghcr.io/umami-software/umami:postgresql-latest
restart: unless-stopped
expose:
- 3000
environment:
DATABASE_URL: postgresql://umami:${DB_PASSWORD}@db:5432/umami
APP_SECRET: ${APP_SECRET}
depends_on:
- db
db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: umami
POSTGRES_USER: umami
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- db_data:/var/lib/postgresql/data
volumes:
db_data:
Notice the app reaches the database at db:5432. Services in one Compose file find each other by service name, the same as on your laptop. The database has no ports or expose at all, because nothing outside the stack should reach it.
Step 3: Deploy the Docker Compose file in Dokploy
- Create a project (call it anything, like "apps").
- Inside it, click Create Service and choose Compose. Leave the type as Docker Compose. (The other type, Stack, is for Docker Swarm, and it can't
build:images.) - Pick where the file comes from. Raw lets you paste the file straight into Dokploy's editor. If it lives in a repo, connect GitHub, GitLab, Bitbucket, Gitea or any Git URL instead, pick the branch, and set the Compose Path (for example
./docker-compose.yml).
Don't deploy yet.
Step 4: Set the environment
Open the Environment tab and add your variables, one per line:
DB_PASSWORD=a-long-random-password
APP_SECRET=another-long-random-string
Dokploy writes these to a .env file next to your Compose file, and Docker Compose fills in every ${...} from it. Save.
Step 5: Add your domain with HTTPS
- At your DNS provider, add an A record (for example
stats.yourdomain.com) pointing to your server's IP. If you use Cloudflare, set it to DNS only (grey cloud) so Let's Encrypt can reach your server. - In Dokploy, open the service's Domains tab and click Add Domain. Host
stats.yourdomain.com, serviceumami(the service name from your file), container port3000, turn on HTTPS, and pick Let's Encrypt.
Now click Deploy. Dokploy pulls the images, starts both containers and shows you the build log. When it says done, open https://stats.yourdomain.com.
If you change a domain later, redeploy. Dokploy adds the routing to your Compose file at deploy time, so a change only takes effect on the next deploy.
Step 6: Deploy on every push (optional)
If the file comes from Git, turn on Auto Deploy. Dokploy gives you a webhook for GitHub, GitLab, Bitbucket or Gitea, so a push to your branch redeploys the stack. That's the whole "CI/CD" most small apps need.
What Dokploy actually does to your file
This part confused me at first, so here it is plainly. Dokploy doesn't run your file exactly as written. At deploy time it adds Traefik labels for each domain and puts the services on a network Traefik can reach. Dokploy has a Preview Compose button that shows you the final file. I'll show a real one in the next section.
If you add no domain and leave isolation off, Dokploy runs your file exactly as you wrote it, with nothing added.
The easier way: just ask Claude
Everything above is clicking through Dokploy. You can skip learning Dokploy by connecting it to Claude (or any AI that speaks MCP) through Zeqqat. You add your Dokploy URL and an API key to Zeqqat once, then paste Zeqqat's MCP URL into Claude as a connector. After that you say what you want.
Here's what I asked:
Check this Compose file before I deploy it and tell me what Dokploy will create. Don't create anything. Then show me what Dokploy really runs for a Compose service I already have.
Here's what happened, call by call:
- Claude searched Zeqqat for "compose" and found Dokploy's Compose tools: create, deploy, preview a template, read a service, and so on.
- It packed my file, plus a small config saying "domain on service
umami, port 3000, generate two passwords", into a template and ran Dokploy's preview. The preview is read only: Dokploy works out what it would create and saves nothing. It came back with:
domains: umami, port 3000, <generated>.sslip.io
envs:
DB_PASSWORD={{zq_secret_t86fs3uu87wisp2e}}
APP_SECRET={{zq_secret_0ahxidz7rt0k612s}}
Dokploy generated both passwords, and neither reached Claude. Zeqqat swapped each one for a {{zq_secret_...}} handle before the answer came back. Claude can pass the handle back to Dokploy when it deploys, without ever seeing the value.
- For the second half, Claude listed my Compose services and read one I already run, a Umami stack much like the file above. It checked it against the rules from Step 2: no
ports, nocontainer_name, variables in the Environment tab, and Dokploy set to write the.envfile. All fine. - Then it asked Dokploy for the converted file, the same thing Preview Compose shows. This is what Dokploy really runs, trimmed and with my names swapped out:
services:
umami:
networks:
- my-umami
labels:
- traefik.enable=true
- traefik.http.routers.my-umami-web.rule=Host(`stats.yourdomain.com`)
- traefik.http.routers.my-umami-web.entrypoints=web
- traefik.http.routers.my-umami-web.middlewares=redirect-to-https@file
- traefik.http.routers.my-umami-websecure.rule=Host(`stats.yourdomain.com`)
- traefik.http.routers.my-umami-websecure.entrypoints=websecure
- traefik.http.routers.my-umami-websecure.tls.certresolver=letsencrypt
- traefik.http.services.my-umami-websecure.loadbalancer.server.port=3000
db:
networks:
- my-umami
networks:
my-umami:
external: true
Those labels are the nginx config and certbot setup you'd otherwise write by hand: one router for plain HTTP that redirects to HTTPS, one for HTTPS with a Let's Encrypt certificate, and the port to send traffic to. The database got the network but no labels, so it's not reachable from outside. That's Dokploy's Isolated Deployments option at work: each stack gets its own network, and Traefik joins it.
Claude also spotted one thing worth fixing: the stack has a database volume and no backup set up for it. Dokploy can back up volumes on a schedule to S3-compatible storage, and I'll set that up next.
Every call was a read. My Zeqqat connection does allow creating and deploying, because those add something new, but delete is switched off, so Claude can set things up and never remove anything. Every call carried the same one-line reason, so in Zeqqat's activity log the whole check shows up as one request I can read back.
What I took from it
Deploying a Docker Compose file on a VPS is four things in Dokploy: paste the file, set the environment, add a domain with HTTPS, deploy. The three file changes (expose instead of ports, no container_name, secrets as variables) are what make it safe on a public server. And if you'd rather not learn where any of that lives, you can hand your AI the file and ask it to check.
Zeqqat is a free and open source MCP gateway for Dokploy. Self-host it or use zeqqat.com. The code is on GitHub.
FAQ
How do I deploy a Docker Compose file to a VPS?
Install a deploy tool like Dokploy on the VPS, create a Compose service, paste your docker-compose.yml or point it at your Git repo, add your environment variables and a domain, and deploy. Without a tool, you copy the file to the server, run docker compose up -d, and set up a reverse proxy and certificates yourself.
Should I use ports or expose in Docker Compose on a server?
Use expose for anything behind a reverse proxy. ports publishes the container on the server's public IP, which skips HTTPS and opens the app to the internet directly. expose keeps it on the Docker network, where the proxy can still reach it.
Can I use Docker Compose on a Hetzner VPS?
Yes. A Hetzner cloud server running Ubuntu or Debian runs Docker and Docker Compose fine. Installing Dokploy on it gives you a web panel to deploy Compose files with domains and HTTPS, on a server with at least 2 GB of RAM and 30 GB of disk.