Dockerize WordPress: Containers Without Losing Your Content
WordPress in Docker requires special handling — the filesystem is not ephemeral when you have uploads, plugins, and themes to persist. We build WordPress container stacks that separate concerns: PHP-FPM for execution, Nginx for serving, MariaDB for data, and named volumes for wp-content so your media survives container restarts.
Need this done for your project?
We implement, you ship. Async, documented, done in days.
Why Dockerize WordPress
WordPress relies heavily on the filesystem — themes, plugins, and uploads live in wp-content/. Naively containerizing WordPress means losing all uploaded media and plugin changes on every restart. But running WordPress on bare metal means dealing with PHP version conflicts, mod_rewrite headaches, and servers that drift into an unmanageable state.
Proper Dockerization solves both problems: the WordPress core runs in an immutable container, while wp-content/uploads, themes, and plugins are mounted as persistent volumes. Updates are controlled, backups are simple, and the environment is reproducible.
Our Docker Implementation for WordPress
Three-container architecture with persistent storage:
- PHP-FPM container:
FROM wordpress:6-php8.3-fpm-alpine— includes WordPress core with PHP-FPM. Customphp.inisetsupload_max_filesize=64M,post_max_size=64M,memory_limit=256M, and OPcache tuning. - Nginx container:
FROM nginx:1.25-alpine— reverse proxy to FPM with FastCGI, serves static files directly, handles URL rewriting for pretty permalinks. - MariaDB container:
FROM mariadb:11— persistent volume for/var/lib/mysql, health check withhealthcheck --connect.
Named volumes: wp-content (uploads, themes, plugins), db-data (MariaDB). The Compose file includes a wp-cli service profile for running WP-CLI commands without SSH.
What You Get
docker-compose.ymlwith WordPress FPM, Nginx, and MariaDB- Persistent volumes for uploads, themes, and database
- Custom
php.iniwith upload limits and OPcache tuning - Nginx config with pretty permalink rewriting and security headers
- WP-CLI service for command-line management
- Backup script using
docker execandmysqldump - Optional Redis object cache container
Why Anubiz Engineering
Ready to get started?
Skip the research. Tell us what you need, and we'll scope it, implement it, and hand it back — fully documented and production-ready.