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 DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk10 min

How to Run WooCommerce with Docker Compose on a VPS

A production-focused guide to running WooCommerce with Docker Compose on a VPS, including the Compose files, HTTPS proxy settings, persistent storage, backups, updates, and troubleshooting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run WooCommerce as two persistent Docker services: a WordPress container and a separate MySQL 8.0+ or MariaDB 10.6+ container on a private Compose network. Put the WordPress service behind HTTPS, keep the database unpublished, store credentials as Docker secrets, and back up both the database and wp-content. This layout is easy to reproduce on a VPS while preserving the data WooCommerce needs for products, orders, settings, themes, extensions, and uploads.

Before deploying, verify WooCommerce’s current baseline: WordPress 6.9 or newer, PHP 8.3 or newer, MySQL 8.0 or newer (or MariaDB 10.6 or newer), HTTPS, and at least 256 MB of WordPress memory. Apache or Nginx is recommended.

As an Amazon Associate I earn from qualifying purchases.

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.

What the production stack contains

Docker Compose does not turn a VPS into a managed WooCommerce platform; it gives you a repeatable way to run and update the application. You remain responsible for operating-system updates, Docker security, DNS, TLS certificates, backups, monitoring, and recovery.

Component Role Production rule
WordPress container Runs WordPress, WooCommerce, PHP, and the web server Use a pinned official image tag and persistent storage for /var/www/html
MySQL or MariaDB container Stores products, orders, settings, posts, users, and WooCommerce tables Attach only to the private database network; publish no host port
Compose networks Provide service-to-service DNS and isolate the database WordPress joins the web and database networks; the database joins only the database network
Named volumes Keep files and database data when containers are recreated Back up both volumes; a running container is not a backup
Reverse proxy Accepts public HTTP(S), manages certificates, and forwards requests Send the original HTTPS protocol to WordPress

The official WordPress Compose pattern starts with docker compose up -d. The first initialization can take a couple of minutes while the database and WordPress files are prepared.

#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.

Check requirements and plan the VPS

Software requirements

  • WordPress 6.9 or later.
  • PHP 8.3 or later, supplied by the selected WordPress image.
  • MySQL 8.0 or later, or MariaDB 10.6 or later.
  • HTTPS for the entire storefront, including login, account, cart, checkout, and payment callbacks.
  • A WordPress memory limit of at least 256 MB.
  • A supported Linux VPS, Docker Engine, and the Docker Compose plugin.

Capacity is workload-dependent

There is no universal CPU, RAM, disk, traffic, or monthly-cost figure that fits every WooCommerce store. Catalog size, concurrent shoppers, image processing, scheduled actions, search, payment callbacks, and backup retention determine the requirement. Start with a VPS appropriate to your expected workload, then monitor CPU, memory, disk space, database growth, PHP errors, and response time. Increase resources before swap activity or a full disk causes checkout failures.

Network and account preparation

  1. Create a non-root deployment account and give it the Docker permissions it needs. Keep root access for administration rather than daily Compose commands.
  2. Point an A record and, if used, an AAAA record for the store hostname to the VPS address.
  3. Allow only SSH and the web ports at the VPS firewall. Do not open MySQL’s port to the internet.
  4. Install Docker Engine and the Compose plugin from the distribution’s supported packages, then verify with docker version and docker compose version.
  5. Create a project directory such as /srv/woocommerce owned by the deployment account.

Create a secure base Compose file

The following file uses the Apache variant of the official WordPress image. It keeps the database on an internal network, uses named volumes, and reads passwords from files rather than committing plaintext credentials to the Compose file.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
services:
  db:
    image: mysql:8.0
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD_FILE: /run/secrets/db_password
      MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db_root_password
    volumes:
      - db_data:/var/lib/mysql
    secrets:
      - db_password
      - db_root_password
    networks:
      - backend

  wordpress:
    image: wordpress:6.9-apache
    restart: unless-stopped
    depends_on:
      - db
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_NAME: wordpress
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD_FILE: /run/secrets/db_password
    volumes:
      - wordpress_data:/var/www/html
    expose:
      - "80"
    secrets:
      - db_password
    networks:
      - frontend
      - backend

volumes:
  wordpress_data:
  db_data:

networks:
  frontend:
  backend:
    internal: true

secrets:
  db_password:
    file: ./secrets/db_password
  db_root_password:
    file: ./secrets/db_root_password

Create the secret files

  1. Make a directory that is readable only by the deployment account: mkdir -p secrets && chmod 700 secrets.
  2. Put a long, unique database-user password in secrets/db_password and a different root password in secrets/db_root_password.
  3. Set restrictive permissions, for example chmod 600 secrets/*, and exclude the directory from version control and off-site configuration repositories that should not contain secrets.
  4. Save the file as compose.yaml and validate it with docker compose config. Fix every validation error before starting the stack.

The db hostname is resolved inside the Compose network; it is not a public DNS name. Do not add a ports entry to the database service. Publishing 3306 would create an unnecessary internet-facing attack surface.

Apache versus PHP-FPM

The Apache image is the simpler choice because it serves HTTP itself. A wordpress:<version>-fpm image is also possible, but it must sit behind a reverse proxy that speaks FastCGI. The FPM container must never be exposed directly to the internet.

Choice Advantages Responsibilities and risks
Apache WordPress image Fewer moving parts; proxy can forward ordinary HTTP Apache and PHP settings are managed inside the image and proxy
PHP-FPM WordPress image Separates web serving from PHP and fits an existing FastCGI proxy Requires correct FastCGI configuration; direct exposure is unsafe

Keep production changes in an override file

A base file can remain useful for staging while production-specific bindings and policies live in compose.production.yaml. For a host-level reverse proxy, add a loopback-only binding and explicit logging:

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.
services:
  wordpress:
    ports:
      - "127.0.0.1:8080:80"
    restart: unless-stopped
    logging:
      driver: json-file
      options:
        max-size: "10m"
        max-file: "5"
  db:
    restart: unless-stopped

Start the merged configuration exactly as follows:

docker compose -f compose.yaml -f compose.production.yaml up -d

Only the reverse proxy can reach port 8080 from the host. If your proxy is another Compose service, attach it to the frontend network and proxy to http://wordpress:80 instead; you do not need a host port in that arrangement.

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

Pin and review image versions

Record the WordPress, PHP, and database tags you deploy. Validate upgrades in a staging project, then change the tags deliberately. Rebuild and redeploy regularly for security updates rather than relying on an unexamined latest tag. Keep the previous image tag and a tested database restore path available for rollback.

Start WordPress and install WooCommerce

  1. From the project directory, run docker compose up -d for a single-file test or the two-file production command above.
  2. Check startup with docker compose ps and inspect messages with docker compose logs -f wordpress db. Wait for the initial database setup to finish.
  3. Open the hostname in a browser. Complete the WordPress installer using the final site administrator account.
  4. In WordPress administration, install and activate WooCommerce, then complete store location, currency, tax, shipping, and payment settings.
  5. Configure readable permalinks and create a test product. Test a full cart and checkout flow before accepting real orders.
  6. After HTTPS is active, set both WordPress Address (URL) and Site Address (URL) to the final https:// address. Do not leave one URL on HTTP.

Set the memory limit

Confirm that WordPress can use at least 256 MB. If the image or host does not already provide that value, add this line to wp-config.php before the line that says WordPress should stop editing:

define( 'WP_MEMORY_LIMIT', '256M' );

Check the effective value in the WordPress Site Health screen and after major plugin changes. A PHP process limit that is lower than WordPress’s setting can still cap real usage.

Put the store behind HTTPS

Terminate TLS at a reverse proxy

Use Nginx, Apache, Caddy, Traefik, or another maintained proxy to obtain and renew the certificate. The proxy should forward the host, client address, and original protocol. A minimal Nginx-style HTTP forwarding block looks like this:

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
server {
    listen 443 ssl;
    server_name shop.example.com;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
    }
}

Use your proxy’s certificate and renewal configuration, and add an HTTP-to-HTTPS redirect. The exact certificate paths and renewal commands depend on the proxy and Linux distribution.

Tell WordPress that the original request was HTTPS

When TLS ends before the WordPress container, add this check to wp-config.php so WordPress and WooCommerce do not treat secure requests as HTTP:

if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' == $_SERVER['HTTP_X_FORWARDED_PROTO'] ) {
    $_SERVER['HTTPS'] = 'on';
}

Only trust this header from your own proxy network; do not allow arbitrary clients to assert it. Once the certificate is installed, clear caches and test login, cart, checkout, account pages, webhooks, and payment callbacks. WooCommerce strongly recommends SSL because checkout and account traffic is sensitive and most payment gateways require it.

Back up files and database data

WooCommerce data lives in two places: wp-content contains themes, extensions, and uploaded media; the database contains products, orders, settings, posts, pages, users, and other tables. A WordPress XML export does not replace a database backup.

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.

Export the database

With the service running and the secret mounted, create a dated dump outside the container:

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.
mkdir -p backups
docker compose exec -T db sh -c 'MYSQL_PWD="$(cat /run/secrets/db_password)" mysqldump -u wordpress wordpress' > "backups/db-$(date +%F).sql"

Use a consistent naming scheme, copy dumps off the VPS, and retain multiple restore points. A dump that remains only on the same disk as the live database does not protect against disk loss.

Copy WordPress content

Copy the persistent content directory to the backup location:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
docker compose cp wordpress:/var/www/html/wp-content "backups/wp-content-$(date +%F)"

Include themes, plugins, uploads, and any custom files your deployment uses. Protect backup storage as carefully as production storage because uploads and configuration can contain private information.

Automate and test restores

  • Schedule database dumps and file copies rather than relying on manual memory.
  • Keep copies on a different host or storage system, with retention that covers your business’s recovery needs.
  • Restore into a separate Compose project on a non-public hostname at regular intervals.
  • Verify that products, orders, media, users, scheduled actions, email, and payment callbacks work after restoration.

A WooCommerce-aware managed backup service can provide scheduled backups, activity logs, and one-click restores; confirm its current availability, retention, geography, and terms before relying on it. Whether backups are self-managed or managed, perform an actual restore drill.

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

Operate the stack without deleting data

Routine inspection

docker compose ps
docker compose logs -f wordpress
docker compose logs -f db
docker compose config

Use the merged -f options for every production command so you inspect and operate the same configuration that is deployed.

Rebuild one service

For a targeted rebuild, Docker documents the pattern below. Substitute your actual service name:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
docker compose build wordpress
docker compose up --no-deps -d wordpress

For image updates, pull and recreate during a maintenance window after testing the new tag. Then verify checkout, scheduled actions, email, webhooks, and payment callbacks.

Understand the two shutdown commands

docker compose down removes containers and networks but preserves named volumes, including the database volume. docker compose down --volumes also removes those volumes and therefore deletes the database data. Never use the volume-removing form as a routine restart. Take and verify backups before any destructive maintenance.

Update safely and keep a rollback path

  1. Take a fresh database dump and a fresh wp-content backup.
  2. Record the active image tags, Compose files, secret names, proxy configuration, and DNS settings.
  3. Clone the stack into staging and test the WordPress, PHP, database, plugin, and theme update there.
  4. Schedule a production maintenance window and announce possible checkout interruption.
  5. Apply one logical change at a time, watching logs and resource usage.
  6. Run a real test order or gateway sandbox transaction, then check email, webhooks, scheduled actions, customer login, refunds, and admin screens.
  7. If the release fails, restore the prior image tag and database backup according to the tested procedure. Do not attempt a rollback without checking database compatibility.

Choose implementation options deliberately

Decision Option A Option B What to evaluate
Web image Apache WordPress image PHP-FPM behind a proxy Configuration complexity, FastCGI expertise, and where access logs and TLS are handled
Database MySQL 8.0+ MariaDB 10.6+ Plugin compatibility, upgrade path, backup tooling, and your team’s database experience
TLS Dedicated reverse proxy TLS on the web container Certificate renewal, header handling, isolation, and whether other services share the proxy
Compose layout One file Base plus production override Reproducibility, reviewability, and separation of staging and production values
Backups Scripts and off-host storage you operate WooCommerce-aware managed service Restore time, retention, audit logs, access controls, and vendor dependence
Hosting responsibility Self-managed VPS WooCommerce hosting partner or agency Who handles patching, monitoring, incident response, scaling, and recovery

Compare these choices by operational ownership, update process, observability, recovery time, and security boundaries rather than by an assumed universal performance number.

Troubleshoot common failures

WordPress reports that it cannot connect to the database

  • Confirm both services are running with docker compose ps.
  • Check that WORDPRESS_DB_HOST is db:3306, not localhost.
  • Verify the database name, user, and secret file match on both services.
  • Read docker compose logs db for first-initialization errors. Changing database credentials after the data volume is initialized does not automatically rewrite existing users.

The browser shows an HTTPS redirect loop

Check that the proxy sends X-Forwarded-Proto: https, that the wp-config.php forwarded-protocol block is present, and that both WordPress URLs use HTTPS. Clear page-cache and proxy-cache entries after correcting the setting.

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

The proxy returns 502 or cannot reach WordPress

For a host proxy, verify the production binding is listening on 127.0.0.1:8080. For a proxy container, verify both services share the frontend network and that the proxy target is wordpress:80. An FPM image requires FastCGI rather than an HTTP proxy_pass.

Uploads fail or images disappear

Confirm that wordpress_data is mounted at /var/www/html, disk space is available, and the web process can write to wp-content/uploads. If files were restored manually, correct ownership inside the container and test a new upload.

Orders are missing after a restart

Check whether someone ran docker compose down --volumes or changed the Compose project name, which can create a different volume. Stop further changes, locate the original volume with docker volume ls, and restore the database and content from the latest verified backups if necessary.

Go-live checklist

  • WooCommerce requirements are met: WordPress 6.9+, PHP 8.3+, MySQL 8.0+ or MariaDB 10.6+, HTTPS, and 256 MB or more of WordPress memory.
  • The database has no public port and is reachable only on the private Compose network.
  • Production bindings, restart policies, and logging are in the production override file.
  • Image tags are recorded and have been tested in staging.
  • HTTP redirects to HTTPS, forwarded headers are configured, and both WordPress URLs use HTTPS.
  • A test product, checkout, account login, email, webhook, and payment callback have succeeded.
  • Database and wp-content backups run automatically, are stored off-host, and have been restored in a drill.
  • The team knows the difference between docker compose down and docker compose down --volumes.

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
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair 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.