How to Self-Host WordPress with Docker and InfraPilot
InfraPilot Team
March 4, 2026
Why Self-Host WordPress?
Managed WordPress hosting is expensive for what it is: a single PHP application and a MySQL database. Kinsta, WP Engine, and Pressable charge $25–50/mo for what amounts to two containers and an Nginx config. Running WordPress yourself on a $6/mo VPS — with InfraPilot managing your reverse proxy, SSL, and monitoring — costs a fraction of that.
Prerequisites
- A Linux VPS with Docker installed (
curl -fsSL https://get.docker.com | sh) - A domain name with an A record pointing at your server IP
- InfraPilot running — install with
curl -fsSL https://infrapilot.org/install.sh | bash
Step 1 — Create the Compose File
Create a directory for your WordPress site and add a docker-compose.yml:
mkdir -p ~/apps/wordpress && cd ~/apps/wordpress
services:
db:
image: mysql:8.0
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: ${DB_PASSWORD}
volumes:
- db_data:/var/lib/mysql
wordpress:
image: wordpress:6-php8.2-fpm-alpine
restart: unless-stopped
depends_on:
- db
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: ${DB_PASSWORD}
WORDPRESS_TABLE_PREFIX: wp_
volumes:
- wp_data:/var/www/html
ports:
- "9000:9000"
volumes:
db_data:
wp_data:
Create a .env file with strong passwords:
DB_ROOT_PASSWORD=change-me-root-password
DB_PASSWORD=change-me-wp-password
Start the stack:
docker compose up -d
Step 2 — Add a Reverse Proxy in InfraPilot
WordPress FPM doesn't serve HTTP directly — you need Nginx in front. InfraPilot handles this for you:
- Open the InfraPilot dashboard → Traffic → Proxy Hosts → Add Proxy Host
- Set the domain to your WordPress domain (e.g.
myblog.com) - Set the forward host to
wordpressand port to9000 - Enable SSL → Let's Encrypt and tick Force SSL
- Save — InfraPilot provisions the certificate and configures Nginx automatically
Step 3 — Run the WordPress Setup Wizard
Navigate to your domain — you'll see the WordPress installation screen. Choose your language, set your site title, and create your admin account. Your site is live with HTTPS in under 5 minutes.
Step 4 — Monitor WordPress with InfraPilot
Back in the InfraPilot dashboard, you can see real-time CPU and memory usage for both the wordpress and db containers. Set up an alert under Security → Alerts to notify you if either container crashes or if memory usage exceeds 80%.
The unified log view streams both WordPress error logs and Nginx access logs in one place — no SSH required to debug a 500 error or a slow query.
Keeping WordPress Updated
To update to the latest WordPress image, pull and restart from the InfraPilot dashboard or run:
docker compose pull && docker compose up -d
InfraPilot's self-update feature also keeps your monitoring layer current — check for updates under Settings → General → Software Update.
Related posts
The Best Self-Hosted Docker Dashboards in 2026 (Honestly Compared)
Portainer, Dockge, Yacht, Lazydocker, InfraPilot — there are more Docker management UIs than ever. Here's an honest breakdown of which one fits which use case, from CLI-lovers to teams that want a full web dashboard.
Nginx Proxy Manager vs InfraPilot: Is There a Better Alternative?
Nginx Proxy Manager is the most popular Docker reverse proxy GUI — but it only manages proxies and SSL. If you're already running Docker containers, there's a case for combining your proxy management with your container dashboard.
Portainer vs InfraPilot: The Honest Docker Management Comparison (2026)
Portainer is great — but it doesn't manage Nginx, SSL, or give you traffic analytics. Here's an honest comparison of when to use Portainer, when to use InfraPilot, and what actually matters for single-server Docker setups.