Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk10 min

How to Install WordPress with Docker Compose on a VPS

A production-minded walkthrough for running WordPress and MariaDB with Docker Compose on a VPS, including secure networking, HTTPS, persistent volumes, backups, updates, and troubleshooting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The reliable way to run WordPress on a VPS with Docker Compose is to deploy two services: a WordPress container and a MariaDB (or MySQL) container. Keep both data directories in named volumes, expose WordPress only on localhost, and put a reverse proxy in front for DNS, HTTPS, and public traffic. This layout lets you recreate or update containers without deleting the site, provided you do not remove the volumes.

What you need before installing

A Docker WordPress deployment has several prerequisites that are easy to overlook. Confirm them before running any Compose command.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Requirement What to verify
VPS operating system A supported 64-bit Linux distribution. Docker currently lists Ubuntu 22.04, 24.04, and 26.04 among its supported Ubuntu releases; check the exact release on your server before following package instructions.
Administrative access SSH access with an account that can use sudo.
DNS An A and/or AAAA record that points your domain to the VPS address.
Storage Enough capacity for the operating system, Docker images, the database, uploads, backups, and logs. There is no universal minimum because media libraries and traffic vary.
Software Docker Engine, Docker CLI, Buildx, and the Docker Compose CLI plugin installed from Docker’s repository.

Use a current Docker repository installation rather than the legacy standalone Compose binary. Docker warns that published container ports can bypass rules normally enforced by ufw or firewalld, so plan the firewall and port mappings together.

Install Docker Engine and Compose on Ubuntu

Docker’s package names and repository steps can change, so use the current instructions for your VPS distribution. On Ubuntu, the documented package set is:

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl status docker
sudo docker run hello-world
sudo docker compose version

The final command should print the installed Compose plugin version. If docker compose is not recognized, the plugin is missing or the installation came from a different package source. Resolve that before creating the application stack.

Create a private Compose project

Make a directory for the deployment and keep the Compose file and environment file together:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
mkdir -p ~/wordpress
cd ~/wordpress

Create .env with unique credentials. Do not commit this file to a public repository or paste it into support forums.

MYSQL_DATABASE=wordpress
MYSQL_USER=wordpress
MYSQL_PASSWORD=replace-with-a-long-random-password
MYSQL_ROOT_PASSWORD=replace-with-a-different-long-random-password

Use separate, randomly generated values for the application password and the root password. Restrict the file to the deployment account, for example with chmod 600 .env.

Define WordPress and MariaDB in compose.yaml

Create compose.yaml in the same directory:

services:
  db:
    image: mariadb:10.6
    restart: unless-stopped
    command: --default-authentication-plugin=mysql_native_password
    environment:
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
    volumes:
      - db_data:/var/lib/mysql

  wordpress:
    image: wordpress:apache
    restart: unless-stopped
    depends_on:
      - db
    ports:
      - "127.0.0.1:8080:80"
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: ${MYSQL_USER}
      WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD}
      WORDPRESS_DB_NAME: ${MYSQL_DATABASE}
    volumes:
      - wp_data:/var/www/html

volumes:
  db_data:
  wp_data:

How the file works

  • db: Runs MariaDB and stores its data in db_data, mounted at MariaDB’s data directory, /var/lib/mysql.
  • wordpress: Runs the Apache-based WordPress image and stores the WordPress tree, including themes, plugins, and uploads, in wp_data at /var/www/html.
  • Service-name networking: WordPress connects to db:3306. The name db is the Compose service name; it is not an external DNS name and does not require a public database port.
  • Loopback binding: 127.0.0.1:8080:80 makes WordPress reachable on the VPS itself but not directly on the public network interface.
  • Restart policy: unless-stopped restarts services after a reboot or crash until you deliberately stop them.

The sample uses mariadb:10.6 as an example. Select and pin a database tag only after checking compatibility with your WordPress version, existing data, and the image’s support lifecycle. The official Compose examples also demonstrate MySQL 8.0.27; neither database family is universally superior. Existing MySQL data, backup tooling, and team experience should determine the choice.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Start the stack and complete WordPress setup

  1. Pull the images:
    docker compose pull
  2. Start both services in the background:
    docker compose up -d
  3. Check container state:
    docker compose ps
  4. Read the latest WordPress messages:
    docker compose logs --tail=100 wordpress

Initialization is not instantaneous. The database must create its system tables before WordPress can complete its first connection. A blank or incomplete first response can simply mean that initialization is still running; inspect both service logs and wait before changing credentials.

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

For a temporary direct test, change the port mapping to 8080:80, recreate the stack, and visit http://VPS_IP:8080. This exposes the port publicly, so use it only briefly and remove the public binding when testing is finished. The safer production mapping keeps the address on loopback for the reverse proxy.

When the installer appears, choose the language, site title, administrator account, and administrator password. Set the site address to the final HTTPS domain rather than a localhost or temporary IP address. That prevents generated links, redirects, and canonical URLs from retaining the test address.

Put the site behind DNS, HTTPS, and a reverse proxy

Point the domain to the VPS

Create the required A record for IPv4 and, if the server is configured for IPv6, an AAAA record. Wait for the records to resolve to the VPS before requesting a certificate. Keep the Compose service on 127.0.0.1:8080; the proxy will be the only public application entry point.

Configure the edge proxy

Use Nginx, Caddy, Traefik, or another trusted reverse proxy to accept requests for the domain and forward them to 127.0.0.1:8080. Configure it to:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
  • Listen for HTTP and redirect it to HTTPS.
  • Terminate TLS and renew the certificate through the proxy’s supported ACME workflow.
  • Forward the original host and client protocol so WordPress can generate correct URLs.
  • Allow request bodies large enough for the media uploads you expect.
  • Send traffic only to the loopback-bound WordPress port.

After HTTPS works, revisit the WordPress settings and confirm both the WordPress Address and Site Address use the final https:// URL. If the site was initially installed at an IP address, change the URLs carefully; an incorrect replacement can produce redirect loops or mixed-content warnings.

Do not expose an FPM container directly

If you choose an image such as wordpress:<tag>-fpm instead of the Apache image, the proxy must speak FastCGI and pass requests to the PHP-FPM process. FastCGI is not an HTTP service and must not be exposed directly to the Internet. The official image guidance also requires the proxy’s script paths to match the FPM image layout: use /usr/src/wordpress rather than assuming the Apache image’s /var/www/html path in every proxy directive. An Apache image is usually simpler when you do not already operate a FastCGI-capable proxy.

Lock down the VPS and containers

  • Publish only the ports you need. A typical public server permits SSH, HTTP, and HTTPS; the database should remain un published.
  • Remember that Docker-published ports can bypass some ufw/firewalld filtering. Review Docker’s packet-filtering behavior and verify access from an external network.
  • Never map 3306 to the VPS public interface for this stack. WordPress reaches MariaDB through the private Compose network at db:3306.
  • Keep .env readable only by the deployment account and rotate credentials if they are disclosed.
  • Use pinned image tags in version control rather than silently tracking an unreviewed moving tag in production.
  • Schedule Docker Engine and image updates, review release notes, and rebuild or redeploy regularly for security fixes.
  • Configure log rotation or a logging driver with rotation. Docker’s default json-file logs can grow until the VPS runs out of disk space.

Understand persistence before changing containers

Named volumes are the persistence boundary in this design:

Volume Container path What it contains
db_data /var/lib/mysql MariaDB system tables and WordPress database data.
wp_data /var/www/html WordPress core files, uploaded media, plugins, themes, and configuration generated in the document root.

docker compose down removes containers and the Compose network but preserves these volumes. Recreating containers with docker compose up -d therefore keeps the site. By contrast, docker compose down --volumes also deletes the database and WordPress volumes. Treat that command as destructive and never use it as routine cleanup on a live site.

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

Compose may prefix volume names with the project directory, so list them before copying or restoring data:

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
docker volume ls
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Back up the database and WordPress files

A VPS snapshot alone is not a substitute for application-level backups. Back up both the logical database and the WordPress files, store the resulting files outside the live volumes and preferably off the VPS, and perform a restore rehearsal.

Export the database

mkdir -p backups
docker compose exec -T db sh -c 'mariadb-dump -u root -p"$MYSQL_ROOT_PASSWORD" "$MYSQL_DATABASE"' > backups/wordpress.sql

This creates a SQL dump of the database named by MYSQL_DATABASE. Protect the dump because it can contain users, settings, post content, and other sensitive information.

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

Archive the WordPress volume

Stop writes briefly for a consistent file snapshot, then archive the named volume. Replace the volume name with the project-prefixed name shown by docker volume ls:

docker compose stop wordpress

docker run --rm 
  -v wordpress_wp_data:/data 
  -v "$PWD/backups":/backup 
  alpine tar czf /backup/wp_data.tgz -C /data .

docker compose start wordpress

If the actual volume is named differently, substitute that name in the -v option. Keep the SQL dump and file archive together for the same backup point. A restore is only trustworthy when you have actually imported the SQL and started a disposable copy of the files successfully.

Update WordPress, images, and the operating system safely

  1. Record the current image tags and keep the Compose file under version control.
  2. Take a fresh database dump and file backup.
  3. Read release notes for the WordPress image, database image, and Docker Engine. Check compatibility before changing a major database tag.
  4. Change the pinned tags deliberately, then pull the new images:
    docker compose pull
  5. Recreate the services:
    docker compose up -d
  6. Check state and logs:
    docker compose ps
    docker compose logs --tail=100 db wordpress
  7. Open the site, log in, test a page, upload, plugin, and administrator action, and monitor disk usage.

Keep the previous Compose file and image tags available as a rollback path. A rollback may still require restoring the database if the upgrade performed an irreversible schema migration, which is why the pre-upgrade backup is essential.

Troubleshoot the most common failures

WordPress cannot connect to the database

Check that WORDPRESS_DB_HOST is exactly db:3306, that the database service is named db, and that the three application credentials in .env match the values used when MariaDB was first initialized. Then inspect both logs:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
docker compose ps
docker compose logs db wordpress

Changing database environment variables after a volume already contains an initialized database does not retroactively change the database users or passwords. Make the credentials agree with the existing data, or perform a planned password change inside MariaDB.

The first page is blank or incomplete

Wait for initialization and inspect the WordPress and database logs. A first request made while MariaDB is creating its tables can fail even though the stack becomes healthy moments later.

The domain redirects to localhost or an IP address

Set both WordPress URL fields to the final HTTPS domain and check the proxy’s forwarded host and protocol headers. Clear browser and proxy caches after correcting the values.

HTTPS works but uploads fail

Check the proxy’s request-body limit, the available disk space, and permissions within the WordPress volume. Also verify that PHP limits in the selected image are sufficient for the file sizes you intend to upload.

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.

A plugin needs a missing PHP extension

The official WordPress image cannot include every possible PHP library. Build a derived image that installs the required extension, pin the resulting image, and test it before deploying to the live service. Do not modify a running container manually and expect the change to survive recreation.

The VPS disk fills unexpectedly

Check Docker images, named volumes, backups, and container logs. Configure log rotation, move backups off the VPS, prune only resources you have verified are unused, and monitor the filesystem before it reaches 100 percent.

Apache versus FPM, and MariaDB versus MySQL

Decision Apache-based WordPress image FPM-based WordPress image
Proxy requirement HTTP reverse proxy forwards to the container’s web server. Reverse proxy must support FastCGI and pass the correct script paths.
Exposure risk Expose only through the HTTP proxy or loopback binding. Never expose the FastCGI endpoint directly; it is not a safe public protocol.
Operational complexity Lower for a first VPS deployment. More moving parts, potentially appropriate when you already operate FastCGI and need that architecture.
Database choice Evaluate
MariaDB Compatibility with your WordPress data, selected image tag, support lifecycle, dump/restore tools, and team familiarity.
MySQL Compatibility with existing databases and plugins, image support lifecycle, backup tooling, and operational experience.

The Compose pattern is the same either way: one private database service, one WordPress service, environment-based connection settings, and separate persistent volumes. Choose the database that best matches the data and maintenance skills you already have rather than assuming one is always faster or safer.

Operational checklist

  • Docker Engine, CLI, Buildx, and the Compose plugin report working versions.
  • The Compose file uses pinned, reviewed image tags.
  • The database has no public port mapping.
  • WordPress is bound to loopback and reached externally through the reverse proxy.
  • DNS resolves to the VPS and HTTP redirects to HTTPS.
  • The WordPress and Site Address values use the final HTTPS domain.
  • .env contains unique secrets and is not committed.
  • Named volumes are present and docker compose down --volumes is treated as destructive.
  • Database and file backups are stored off the VPS.
  • A restore rehearsal has succeeded.
  • Log rotation, disk monitoring, update review, and rollback procedures are in place.

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.

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

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.