Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Docker Compose is a practical way to run a complete self-hosted application stack on one VPS: the application, database, reverse proxy, and supporting services are defined as code and started together. A production setup is more than a development YAML file, however. It needs persistent volumes, private networks, restart and health policies, injected secrets, deliberate port bindings, HTTPS, backups, and a tested update path.

This guide shows a reusable Compose architecture and then applies it to WordPress, Ghost, and Nextcloud. The examples assume one Linux VPS and a current Docker Engine with the Compose plugin. Exact CPU, memory, storage, and dependency requirements must be taken from the application’s current support matrix because they vary with traffic, plugins, files, and database size.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How a Compose deployment on a VPS is arranged

Docker’s production guidance describes a single server as the easiest way to deploy an application because it resembles the development environment while keeping all services under one operational boundary. Compose supplies that boundary: one project file defines containers, networks, volumes, health checks, and secrets, and one command can recreate the stack.

A sensible VPS layout separates traffic-facing and internal responsibilities:

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.
  • Reverse proxy: the only service normally bound to the VPS’s public HTTP and HTTPS ports. It terminates TLS and forwards requests to the application over the private Docker network.
  • Application: the web or API service, attached to the front network and the private back network as needed.
  • Database: attached only to the back network, with no published host port.
  • Supporting services: Redis, background workers, search, or mail relays remain private unless a documented integration requires otherwise.
  • Named volumes: hold uploads, configuration, certificates, and database files outside replaceable containers.

Running everything on one VPS is not the same as having high availability. A host failure, disk failure, or kernel update can affect every service, so off-host backups and a restore procedure are part of the design rather than optional extras.

Prepare the VPS before starting Compose

  1. Select a supported Linux distribution. Check the target applications’ support pages as well as Docker Engine and Compose-plugin compatibility. Apply security updates before exposing the host.
  2. Install Docker Engine and the Compose plugin using Docker’s current installation instructions for that distribution. Verify with docker version and docker compose version.
  3. Create a dedicated deployment directory owned by a non-root operational account, for example /srv/my-app. Keep routine Compose commands under that account; reserve sudo for host administration.
  4. Configure SSH and the firewall. Restrict SSH to trusted source addresses where practical, use key authentication, and allow only SSH plus TCP 80 and 443 unless the proxy or application explicitly requires another port.
  5. Point DNS at the VPS. Create the required A or AAAA records and allow propagation before requesting certificates. Do not publish an application’s internal port merely to test DNS.
  6. Prepare storage. Leave headroom for database growth, uploaded files, image layers, logs, and temporary backups. Monitor the filesystem rather than waiting for Docker to fail writes.
  7. Set time and update policies. Accurate system time is important for TLS and scheduled jobs. Decide who receives security updates and how maintenance windows are communicated.

Use a predictable project layout

my-app/
  compose.yaml
  compose.production.yaml
  .env.example
  secrets/
    db_password.txt
  backups/
  README.md

Keep the real .env file and everything under secrets/ out of version control. Give secret files restrictive permissions, such as owner read-only, and ensure the deployment account can read them without making them world-readable. Pin image tags after checking each application’s compatibility matrix; avoid silently following latest in production. Record the selected tags and upgrade notes in the README so a rollback is reproducible.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A reusable production-oriented Compose file

services:
  app:
    image: example/app:1.2
    restart: unless-stopped
    networks: [front, back]
    environment:
      DATABASE_HOST: db
      DATABASE_PASSWORD_FILE: /run/secrets/db_password
    secrets: [db_password]
    depends_on:
      db:
        condition: service_healthy
    volumes:
      - app_data:/var/lib/example

  db:
    image: postgres:16
    restart: unless-stopped
    networks: [back]
    environment:
      POSTGRES_DB: app
      POSTGRES_USER: app
      POSTGRES_PASSWORD_FILE: /run/secrets/db_password
    secrets: [db_password]
    volumes:
      - db_data:/var/lib/postgresql/data
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -U app -d app']
      interval: 10s
      timeout: 5s
      retries: 5

  proxy:
    image: caddy:2
    ports:
      - '80:80'
      - '443:443'
    networks: [front]
    volumes:
      - caddy_data:/data
      - caddy_config:/config

volumes:
  app_data:
  db_data:
  caddy_data:
  caddy_config:

secrets:
  db_password:
    file: ./secrets/db_password.txt

networks:
  front:
  back:
    internal: true

Replace the example image, data path, environment names, and probe with values from the target application’s documentation. The database password is read from a mounted secret rather than stored in the image or ordinary environment text. The _FILE convention works only when that image implements it; otherwise use the image’s documented secret mechanism.

Why the health check matters

depends_on with condition: service_healthy delays application creation until the database reports healthy. It does not run schema migrations, prove that credentials are correct, or guarantee that the application itself is ready for users. Keep application-level retry logic and migration steps where the vendor requires them.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

Why named volumes matter

A named volume stores state on the Docker host outside the container lifecycle. Recreating an image therefore does not remove database files or uploaded content. Volumes are still vulnerable to host loss, accidental deletion, and corruption, so they must be backed up independently.

Add a production override instead of editing the base file

services:
  app:
    ports: []
    logging:
      options:
        max-size: '10m'
        max-file: '3'
  db:
    ports: []

The override removes accidental direct publication of application and database ports and limits local JSON-log growth. Keep development conveniences in compose.yaml and production-only behavior in compose.production.yaml; this makes local testing and review easier.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Render the merged file first: docker compose -f compose.yaml -f compose.production.yaml config.
  2. Inspect the rendered output for image tags, interpolated values, mounts, networks, secrets, and every published port.
  3. Start or reconcile the stack: docker compose -f compose.yaml -f compose.production.yaml up -d.
  4. Check state with docker compose ps and inspect recent output with docker compose logs --tail=100 app.
  5. When rebuilding one service, run docker compose build web followed by docker compose up --no-deps -d web, substituting the actual service name. Keep the previous image tag available until verification is complete.

HTTPS and the reverse-proxy boundary

Bind only the proxy to ports 80 and 443. Configure its virtual host for the real domain, certificate storage, and an upstream such as app:3000 on the front network. The exact upstream port and proxy syntax come from the application and proxy documentation. Persist the proxy’s certificate and configuration volumes so a container replacement does not discard them.

Applications must know that the original request was HTTPS. The proxy should pass the documented forwarded headers, and the application should be configured to trust that proxy rather than every possible source. Open direct application ports only when a documented protocol requires it, and then restrict the firewall or bind to a private interface.

Rank #3
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

WordPress with MySQL

Docker publishes an official WordPress/MySQL Compose sample that is a useful starting point. For a VPS deployment, put MySQL on the back network, mount a named volume at the image’s database path, and expose WordPress only through the reverse proxy. Supply the database password through a secret file when the selected image supports the corresponding _FILE variable.

Production adjustments

  • Use a supported MySQL image tag and match the WordPress image’s documented database requirements.
  • Set the public site URL and HTTPS behavior consistently so WordPress does not generate HTTP links or redirect loops.
  • Persist the WordPress content directory, including uploads, themes, and plugins, in a named volume or a deliberately managed bind mount.
  • Add a MySQL health check and make the WordPress service wait for database health, while still allowing for initialization time.
  • Test media uploads, permalink rewrites, scheduled cron events, plugin updates, and a complete database-and-files restore before calling the site production-ready.

Back up the database separately from the content volume. A file-only backup cannot reconstruct posts and settings, while a database dump alone omits uploaded media and installed extensions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Ghost with MySQL 8 and forwarded HTTPS headers

The official Ghost image specifies MySQL 8, HTTPS, and a reverse proxy that sends X-Forwarded-For, X-Forwarded-Host, and X-Forwarded-Proto set to https for production. Use a MySQL 8 service on the private network, set Ghost’s url to the canonical HTTPS domain, and persist Ghost’s content volume.

Deployment checks

  • Do not publish Ghost’s internal HTTP port directly to the internet; route it through the proxy.
  • Confirm that the proxy preserves the host and scheme headers, otherwise admin URLs, redirects, and secure cookies can be wrong.
  • Back up the content volume and MySQL database together so an article and its images remain consistent.
  • After an upgrade, test the admin area, image uploads, member or newsletter features enabled in the installation, and canonical redirects.

Nextcloud behind a reverse proxy

Nextcloud’s basic container setup does not provide SSL and is intended to run behind a proxy. Keep the Nextcloud data volume and database persistent, and add Redis when the supported deployment method requires it for locking or caching.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

Proxy trust and validation

Configure trusted_proxies with the proxy’s private address or CIDR, not with an unrestricted value. This prevents clients from spoofing forwarded client information. Set the external HTTPS scheme as documented by the Nextcloud release you deploy.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Verify WebDAV methods through the proxy, not only ordinary browser pages.
  • Test uploads larger than the default web-server limit and align proxy, PHP, and application limits.
  • Confirm background jobs run on schedule and do not depend on a browser request.
  • Check that generated links use HTTPS and that the client IP shown in logs is the expected forwarded address.

Secrets, networks, and ports

Compose secrets are declared once and mounted only into services that need them, normally under /run/secrets/. They keep credentials out of image layers and reduce accidental exposure in environment listings. Rotate a secret by creating the replacement file, updating the service, and restarting only the services that consume it; test the new credential before deleting the old one when the application supports overlap.

Use an internal back network for databases and queues. A service does not need a host ports entry to be reachable by another container: Compose DNS resolves its service name, such as db. Prefer no ports entry for internal services. If host-side administration is necessary, bind a temporary port to loopback and remove it after the task.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Backups and restore drills

Back up both named volumes and logical database dumps to storage outside the VPS. A snapshot left on the same disk does not protect against disk loss, ransomware, or an operator deleting the project.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

Logical dumps

For the PostgreSQL service in the sample, a dump can be created with docker compose exec -T db pg_dump -U app app > backups/app-$(date +%F).sql. For a MySQL-based stack, use the image’s client and credentials, for example docker compose exec -T db mysqldump -u root -p app > backups/app-$(date +%F).sql; the command prompts for the password instead of putting it in shell history.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Restore test

  1. Provision a disposable project with the same image tags and an empty database volume.
  2. Restore the SQL dump and copy the application data volume into the expected path.
  3. Start the proxy and application with the production configuration.
  4. Check login, representative records, uploaded files, background jobs, and links generated with HTTPS.
  5. Record the elapsed time and any manual steps in the README, then remove the disposable environment.

Updates, rollback, and observability

Update one service at a time after reading its release notes and compatibility requirements. Take a fresh database dump, preserve the previous image tag, render the merged configuration, and deploy during a maintenance window. Watch docker compose ps, application logs, restart counts, certificate renewal, and disk usage. A restart policy can recover a crashed process, but it cannot fix a bad migration or an exhausted filesystem.

If a release fails, stop the affected service, restore the previous image tag, and restore the database backup when the migration is not backward-compatible. Do not roll back the container while leaving an incompatible database schema without a documented downgrade procedure.

Comparison of the three common stacks

Stack Core dependency Persistent state Public exposure HTTPS and proxy requirement Readiness and upgrade focus VPS sizing
WordPress WordPress with MySQL MySQL data plus WordPress content and uploads; dump the database and archive content Proxy only; MySQL private Use the site’s canonical HTTPS URL and prevent mixed-content or redirect errors MySQL health check; test uploads, permalinks, cron, plugins, and restore Not stated; depends on plugins, traffic, media, and database growth
Ghost Ghost with MySQL 8 MySQL data plus the Ghost content volume Proxy only; Ghost and MySQL private HTTPS plus X-Forwarded-For, X-Forwarded-Host, and X-Forwarded-Proto: https Verify admin, uploads, redirects, and compatibility after image or schema changes Not stated; measure the workload and content growth
Nextcloud Nextcloud database, with Redis where the supported deployment requires it Nextcloud data volume plus database; include large files in backup planning Proxy only; database and Redis private Configure explicit trusted proxy addresses and preserve HTTPS scheme Check WebDAV, large uploads, background jobs, locking, and generated URLs Not stated; file volume and concurrent users are the controlling factors

Common failures and their fixes

  • Containers restart repeatedly: inspect docker compose logs, then check missing secrets, unsupported image combinations, permissions, and database health rather than merely increasing restart attempts.
  • 502 or 504 from the proxy: verify the upstream service name and internal port, confirm both containers share the front network, and check application readiness.
  • Redirect loops or HTTP links: configure the application’s canonical HTTPS URL and ensure the proxy forwards the documented host and scheme headers.
  • Data disappears after recreation: inspect mounts with docker compose config and docker volume ls; confirm that state is in a named volume rather than the container’s writable layer.
  • Database is exposed: remove its ports entry, keep it on the internal network, and review the rendered production configuration before restarting.
  • Uploads fail at larger sizes: align proxy, web server, runtime, and application limits, then test an upload through the public HTTPS path.
  • Disk fills unexpectedly: review JSON logs, unused images, temporary backup files, and volume growth; retain only the backup generations your recovery policy requires.

Pre-launch checklist

  1. Confirm supported Linux, Docker Engine, Compose plugin, and application image tags.
  2. Review the merged output from docker compose config; no database or internal application port should be public.
  3. Verify secret-file permissions and ensure .env and secrets/ are ignored by version control.
  4. Confirm DNS, firewall rules, certificate storage, and forwarded-header settings.
  5. Start the stack and wait for health checks before enabling public traffic.
  6. Exercise login, uploads, scheduled work, proxy behavior, and application-specific protocols.
  7. Create an off-host backup and complete a restore drill using the pinned image tags.
  8. Document the upgrade, rollback, and emergency access procedures for the next operator.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.