Skip to main content
To keep Docker data across restarts and rebuilds, store it in named volumes or bind mounts, never only inside the container; then back those volumes up off the server. This guide sets that up on an Ubuntu VPS with Docker Compose and a Traefik reverse proxy. A container’s own filesystem is thrown away when the container is removed or recreated. Anything you need to keep, such as database files or uploads, must live in a volume.

Bind mounts vs. volumes

  • Bind mounts map a host folder (for example /opt/app/data) into the container. Handy for config files you edit by hand.
  • Named volumes are managed by Docker under /var/lib/docker/volumes. They’re the usual choice for database data such as PostgreSQL or MySQL.

Step 1: Install Docker

Install Docker Engine and the Compose plugin with Docker’s official convenience script:
You can read get-docker.sh before running it. Docker also documents a manual apt repository install, which gives you more control on production servers.

Step 2: Write a Compose file with persistent storage

This compose.yml runs Traefik as a reverse proxy in front of a web app whose data lives in a named volume:
Start it with sudo docker compose up -d. Add HTTPS with Traefik’s Let’s Encrypt support before going live; see the Traefik documentation.
Don’t publish Traefik’s dashboard (--api.insecure=true on port 8080) on a public server: it has no login. Also note that ports published by Docker bypass ufw rules, so only publish ports you mean to expose, or bind them to 127.0.0.1.

Step 3: Back up your volumes

Volumes survive container restarts, not disk failures or an accidental docker volume rm. FlashRDP is an unmanaged host: we run the hardware, network and power, and target 99.9% uptime, while you manage the OS, containers and application data. Back up a volume to a compressed archive in the current folder with a temporary container:
Schedule it nightly with cron and copy the archives off the server, for example to S3-compatible storage.
For databases, back up with the database’s own tool (pg_dump, mysqldump) or stop the container first. Copying a live database’s files can produce a backup that won’t restore.
You can also turn on server-level backups from your server’s Backups tab in the Billing Portal. They’re included on quarterly, semi-annual and annual billing; monthly servers need the Backups add-on. See Back Up and Restore Your Server. Need a server? Deploy an Ubuntu VPS.

Back Up and Restore Your Server

Ubuntu VPS

Host Your Own PaaS with Coolify

Connect via SSH

Last modified on October 16, 2026