This tutorial installs Dokploy v0.31.4 on an Ubuntu 24.04 VPS without ever exposing the initial admin sign-up page to the public internet. Before running the official installer, we block external access to port 3000 in the iptables raw table (ahead of Docker Swarm's NAT rules), create the first admin account through an SSH tunnel, move the dashboard behind a custom domain with Traefik HTTPS, and finish with S3 backups and safe updates.
On this page
- What you will need
- Why you should not run the default installer blindly
- 1. Prepare the server, SSH, and base firewall
- 2. Block external access to port 3000 before installing
- 3. Download and run the pinned Dokploy installer
- 4. Create the admin account through an SSH tunnel
- 5. Put the dashboard behind a domain with Traefik HTTPS
- 6. Back up Dokploy (database, `/etc/dokploy`, and encryption key)
- 7. Update Dokploy safely
- Common issues after installation
- Next steps
All commands, service names, secrets, and paths below were verified directly against Dokploy v0.31.4 upstream source (install.sh, traefik-setup.ts, web-server.ts, and encryption.ts).
What you will need
- A 64-bit Ubuntu 24.04, Ubuntu 22.04, or Debian 12 VPS with key-based SSH access. Dokploy does not yet list Debian 13 among tested operating systems.
- A domain where you can create
ADNS records. Examples below usedokploy.example.com. - Ports
80,443, and3000free on the server (the installer aborts if anything is already listening on any of them).
The official Dokploy documentation lists a minimum of 2 GB RAM and 30 GB free disk space. In production, that baseline only covers the panel itself plus one light service: Docker image builds and application databases quickly consume extra memory and disk. A 4 vCPU / 8 GB RAM VPS gives comfortable headroom for multiple apps, PostgreSQL, and builds without slowing down the dashboard.
If you want to skip manual setup, Nuvits also offers Dokploy preinstalled on Linux VPS plans running Ubuntu 22.04, Ubuntu 24.04, or Debian 12, with port 3000 already blocked from the public internet and initial access over the same SSH tunnel shown here.
Why you should not run the default installer blindly
The one-liner on the homepage (curl -sSL https://dokploy.com/install.sh | sh) initializes a single-node Docker Swarm with three core containers — dokploy, dokploy-postgres (postgres:16), and dokploy-traefik (traefik:v3.7.19) — and publishes port 3000 in host mode on every interface. That leaves three immediate gaps:
- The first visitor to port
3000becomes root admin. Until you register the first account, any scanner hittinghttp://IP:3000can claim the dashboard and gain control over/var/run/docker.sockon the host. - Initial registration happens over plain HTTP. Without an SSH tunnel or HTTPS, your admin credentials cross the internet unencrypted.
ufwdoes not block Docker Swarm's published port3000. Docker inserts its owniptablesrules ahead ofufw, so denying3000inufwalone still leaves the dashboard open to the internet — see The Docker port stays open with ufw.

The steps below close all three gaps before the first container starts.
1. Prepare the server, SSH, and base firewall
If your VPS starts with root access, create an operational user with sudo and copy your public SSH key:
adduser deploy
usermod -aG sudo deploy
install -d -m 700 -o deploy -g deploy /home/deploy/.ssh
install -m 600 -o deploy -g deploy ~/.ssh/authorized_keys /home/deploy/.ssh/Open a second SSH session as deploy and verify sudo -v works before locking down SSH. Run the remaining commands as deploy.
Disable password authentication and direct root SSH login:
sudo nano /etc/ssh/sshd_config.d/10-hardening.confPasswordAuthentication no
KbdInteractiveAuthentication no
PermitRootLogin noTest the SSH configuration and restart the daemon:
sudo sshd -t
sudo systemctl restart sshAllow only SSH, HTTP, and HTTPS (including UDP 443 for Traefik HTTP/3) in ufw:
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443
sudo ufw enable
sudo ufw statusIf your provider also has an external cloud firewall in the control panel, allow only 22/tcp, 80/tcp, and 443 (TCP and UDP) there as well.
2. Block external access to port 3000 before installing
The dokploy Swarm service created by install.sh binds --publish published=3000,target=3000,mode=host on all addresses. To keep port 3000 unreachable from outside while still allowing localhost (your SSH tunnel) and internal Docker bridges, install a small filter in the iptables and ip6tables raw table, which runs before Docker's NAT rules:
sudo tee /usr/local/sbin/dokploy-port-guard >/dev/null <<'EOF'
#!/bin/sh
set -e
for table in iptables ip6tables; do
$table -t raw -N DOKPLOY-GUARD 2>/dev/null || true
$table -t raw -F DOKPLOY-GUARD
for iface in lo docker+ br-+ veth+; do
$table -t raw -A DOKPLOY-GUARD -i "$iface" -j RETURN
done
$table -t raw -A DOKPLOY-GUARD -p tcp --dport 3000 -j DROP
$table -t raw -C PREROUTING -j DOKPLOY-GUARD 2>/dev/null || $table -t raw -I PREROUTING -j DOKPLOY-GUARD
done
EOF
sudo chmod 700 /usr/local/sbin/dokploy-port-guardCreate a systemd unit so the guard is restored automatically on every reboot before docker.service starts:
sudo tee /etc/systemd/system/dokploy-port-guard.service >/dev/null <<'EOF'
[Unit]
Description=Block external access to Dokploy port 3000
DefaultDependencies=no
After=local-fs.target systemd-modules-load.service
Before=network-pre.target docker.service
Wants=network-pre.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/local/sbin/dokploy-port-guard
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now dokploy-port-guard.service
sudo iptables -t raw -L DOKPLOY-GUARD -n -vConfirm the output lists RETURN rules for local/Docker interfaces followed by DROP on tcp dpt:3000.
3. Download and run the pinned Dokploy installer
Fetch the installer from the v0.31.4 GitHub release so you control the exact version and can inspect the script before running it:
curl -fsSL https://github.com/Dokploy/dokploy/releases/download/v0.31.4/install.sh -o dokploy-install.sh
less dokploy-install.shWhen executed as root, the script:
- Verifies that ports
80,443, and3000are unused. - Installs Docker (
28.5.0, held withapt-mark holdto prevent accidental upgrades) if Docker is not already present. - Initializes Docker Swarm (
docker swarm init) and creates the attachable overlay networkdokploy-network. - Creates
/etc/dokploywith mode755(root-only writes) and generates two random Docker Secrets:dokploy_postgres_passwordanddokploy_auth_secret. - Starts the Swarm services
dokploy-postgres(postgres:16) anddokploy(dokploy/dokploy:v0.31.4), plus the standalone containerdokploy-traefik(traefik:v3.7.19).
Run the installer with the pinned version:
sudo DOKPLOY_VERSION=v0.31.4 bash dokploy-install.shWait 15 to 30 seconds and verify all three components are running:
sudo docker service ls
sudo docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}'You should see dokploy and dokploy-postgres at 1/1 replicas in docker service ls, and dokploy-traefik listening on ports 80 and 443. At the end, the script prints http://IP:3000 — that public URL will not load from outside because dokploy-port-guard is blocking it, which is exactly what we want.
4. Create the admin account through an SSH tunnel
On your local machine, open an SSH tunnel to port 3000:
ssh -N -L 3000:127.0.0.1:3000 deploy@VPS_IPKeep that terminal running, open http://localhost:3000 in your browser, and create the administrator account using a strong password stored in your password manager. Once the first account is created, Dokploy closes public registration.
Right after signing in:
- Go to Settings → Profile, enable Two-Factor Authentication (2FA), and save the recovery codes outside the VPS.
- Clean up the downloaded installer on the VPS (
rm -f ~/dokploy-install.sh).
5. Put the dashboard behind a domain with Traefik HTTPS
In your DNS provider, create an A record pointing dokploy.example.com to the VPS's public IPv4 address. Verify propagation before requesting a certificate:
dig +short dokploy.example.com AOnce DNS resolves to your VPS IP:
- Inside the Dokploy panel (still via the SSH tunnel), open Settings → Web Server → Server Domain.
- Set Domain to
dokploy.example.com. - Enter a real e-mail address in Let's Encrypt Email for certificate notices.
- Enable HTTPS, select Let's Encrypt as the certificate provider, and save.
Dokploy writes the dynamic route under /etc/dokploy/traefik/dynamic, and dokploy-traefik issues the TLS certificate automatically. Verify from outside the VPS:
curl -I https://dokploy.example.comExpect HTTP/2 200 (or an HTTPS redirect to /login). You can now close the SSH tunnel and use the panel over HTTPS while keeping dokploy-port-guard enabled — port 3000 stays closed to the internet, and the SSH tunnel remains available as emergency access if DNS or Traefik ever breaks.
6. Back up Dokploy (database, /etc/dokploy, and encryption key)
Dokploy's state lives in three places:
- The panel PostgreSQL database (
dokploy-postgres, volumedokploy-postgres). - The
/etc/dokploydirectory (Traefik configuration, SSH keys created by Dokploy, and project/compose files). - The encryption secret used to protect stored credentials in PostgreSQL (
dokploy_auth_secret, derived with AES-256-GCM inencryption.ts).
Scheduled S3 backups (recommended)
The cleanest approach for production is Dokploy's built-in web server backup:
- In Settings → S3 Destinations, add an S3-compatible bucket (Cloudflare R2, Backblaze B2, AWS S3, or an external MinIO instance).
- In Settings → Web Server → Backups, create a daily schedule pointing to that bucket and enable
Include encryption key.
With that option enabled, Dokploy builds a .zip containing a custom-format dump of dokploy-postgres (pg_dump -Fc), the /etc/dokploy tree, and encryption.key (the derived decryption key required to read stored secrets after restoring to a new VPS, without exporting the raw BETTER_AUTH_SECRET).
Manual CLI backup before major changes
Before upgrading or testing risky changes, you can also grab a quick manual snapshot of the database, /etc/dokploy, and the dokploy_auth_secret Swarm secret (stored outside /etc/dokploy):
PG_CID=$(sudo docker ps --filter "name=dokploy-postgres" --filter "status=running" -q | head -n 1)
DOKPLOY_CID=$(sudo docker ps --filter "label=com.docker.swarm.service.name=dokploy" --filter "status=running" -q | head -n 1)
mkdir -p ~/backups-dokploy && chmod 700 ~/backups-dokploy
(
umask 077
sudo docker exec "$PG_CID" pg_dump -Fc -U dokploy -d dokploy > ~/backups-dokploy/dokploy-db-$(date +%F).dump
sudo tar czf ~/backups-dokploy/etc-dokploy-$(date +%F).tar.gz -C /etc dokploy
sudo docker exec "$DOKPLOY_CID" cat /run/secrets/dokploy_auth_secret > ~/backups-dokploy/dokploy-auth-secret.txt
)Copy those files off the VPS with scp, store dokploy-auth-secret.txt separately from the dump in your password manager, and delete it from the VPS (rm -f ~/backups-dokploy/dokploy-auth-secret.txt) — without it, a manual dump restored on another VPS cannot decrypt credentials stored in the panel. Keep in mind this backs up the Dokploy panel itself — configure separate S3 backup schedules for each application database you deploy.
7. Update Dokploy safely
You can upgrade in two ways — always after checking the release notes at github.com/Dokploy/dokploy/releases and verifying your latest backup:
- From the dashboard: when a new stable release is available, Dokploy displays an update notice and runs
docker service update --force --image dokploy/dokploy:<version> dokploy. - From the terminal with a pinned tag:
sudo docker pull dokploy/dokploy:v0.31.4
sudo docker service update --image dokploy/dokploy:v0.31.4 dokployReplace v0.31.4 with the target release tag. Swarm pulls the new image and replaces only the dokploy service, leaving dokploy-postgres, dokploy-traefik, volumes, and your running apps untouched. Confirm the active image after a minute:
sudo docker service inspect dokploy --format '{{.Spec.TaskTemplate.ContainerSpec.Image}}'Common issues after installation
Error: something is already running on port 80(or443/3000) during installation: check what owns the port withsudo ss -tulnp | grep -E ':(80|443|3000) 'and stop/remove pre-existing web servers (apache2,nginx, orcaddy) before runninginstall.sh.- Dashboard domain shows a certificate error or Traefik 404: confirm
dig +short dokploy.example.com Areturns the VPS IPv4 (disable CDN orange-cloud proxying during initial issuance or use DNS-01) and inspectsudo docker logs --tail=80 dokploy-traefik. - Builds freeze or exit with
OOMKilled: parallel Next.js, Rust, or Nuxt builds can spike memory fast. On servers under 8 GB RAM or hosting multiple stacks, limit concurrent builds or move up a memory tier.
Next steps
- Still deciding between Dokploy and Coolify for your server? Read our side-by-side breakdown in Coolify vs Dokploy on a VPS: which one to choose.
- Want to understand why
ufwdoes not filter ports published by Docker containers? See The Docker port stays open with ufw. - Compare Ubuntu 24.04 plans with optional preinstalled Dokploy on Docker VPS and Linux VPS.