Getting Started

Docker4WordPress is a set of docker containers optimized for WordPress. Use docker-compose.yml file from docker4wordpress repository to spin up local environment on Linux, Mac OS X and Windows.

Docker4WordPress is designed to be used for local development, if you're looking for a dev/staging/production solution consistent with Docker4WordPress check out Wodby.

Overview

The WordPress stack consist of the following containers:

Container Versions Service name Image Enabled by default
Nginx 1.13, 1.12 nginx wodby/wordpress-nginx
Apache 2.4 php wodby/wordpress-apache
WordPress 4 php wodby/wordpress
PHP 7.1, 7.0 php wodby/wordpress-php
MariaDB 10.1 mariadb wodby/mariadb
Redis 3.2 redis wodby/redis
Varnish 4.1 varnish wodby/wordpress-varnish
AthenaPDF latest athenapdf athenapdf-service
phpMyAdmin latest pma phpmyadmin
Mailhog latest mailhog mailhog
Portainer latest portainer portainer
Traefik latest traefik _/traefik

Supported WordPress versions: 4

Requirements

Must know before you start

  1. To make sure you don't lose your MariaDB data DO NOT use docker-compose down (Docker will destroy volumes), instead use docker-compose stop. Alternatively, you can specify manual volume for /var/lib/mysql (see compose file), this way your data will always persist
  2. To avoid potential problems with permissions between your host and containers please follow this instructions
  3. For macOS users: Out of box Docker for Mac has poor performance on macOS. However there's a workaround based on docker-sync project, read instructions here

Usage

There 2 options how to use docker4wordpress – you can either run vanilla WordPress from the image or mount your own WordPress codebase:

1. Run Vanilla WordPress from Image (default)

  1. Download docker-compose.yml file
  2. Run containers: docker-compose up -d
  3. Wait a few seconds for containers initialization
  4. That's it! Proceed with WordPress installation at http://wp.docker.localhost:8000. Default database user, password and database name are all wordpress, database host is mariadb
  5. You can see status of your containers and their logs via portainer: http://portainer.wp.docker.localhost:8000

2. Mount my WordPress Codebase

  1. Read must know before you start
  2. Download docker-compose.yml file to your WordPress project root
  3. Replace php image from wodby/wordpress (PHP + vanilla WordPress) to wodby/wordpress-php (just PHP)
  4. Update nginx/apache and php volumes to - ./:/var/www/html to mount your codebase
  5. Ensure your wp-config.php has the same credentials as mariadb service
  6. Optional: import existing database
  7. Optional: uncomment lines in the compose file to run redis, varnish, phpmyadmin (pma)
  8. Optional: customize domains
  9. Run containers: docker-compose up -d
  10. That's it! Your WordPress website should be up and running at http://wp.docker.localhost:8000. If you need to run multiple projects simultaneously see this article
  11. You can see status of your containers and their logs via portainer: http://portainer.wp.docker.localhost:8000

You can stop containers by executing:

docker-compose stop

Also, read how to access containers and how to get logs

Status

We're actively working on this instructions and containers. More options will be added soon. If you have a feature request or found a bug please submit an issue on GitHub or Wodby Slack join us on Slack

We update containers from time to time by releasing new images tags.

License

This project is licensed under the MIT open source license.