Docker-based WordPress stack
Branch: master
Clone or download
Pull request Compare This branch is 17 commits ahead, 262 commits behind wodby:master.
allurewebsolutions Many updates (see full commit message)
- Add .ENV
- Create make file
- Update README
- Simplify docker-compose
Latest commit 9b03d55 Mar 13, 2018

WordPress Docker Starter


This is a docker starter specifically tailored for WordPress projects. The goal of the repo is to help you efficiently setup a local development environment with either a fresh installation of WordPress, or cloning another site.

Read the documention from which this repo is forked: Getting Started

Repo Structure

Files/Folders Description
bin helper scripts
config config files (php)
data db saved here
init init scripts (sql)
www wordpress files located here
.env sets variables defines make commands

Getting Started

Setting up your project

  1. Open the .env file and replace <<project-name>> with a name for your project

Fresh Installation

  1. Setup .env
  2. Run the Install WordPress or Start Mac scripts (see "Helper Scripts" section below)

Cloning Existing Site

  1. Setup .env
  2. Place the database export into init/db
  3. Run the Install WordPress or Start Mac scripts (see "Helper Scripts" section below)
  4. Copy plugins/themes/media into www/wp-content


This repo comes with a few helper bash scripts to make it easier to accomplish certain functions. Run all of them using this format from the project root: sh bin/ COMMAND

Helper scripts

Start Project Scripts (Mac only for now)

One single script that starts up your project. It will ask you if you want to install WordPress as well, which will then run the both the Install WordPress and Traefik Help scripts below.


  • Start containers (default): sh bin/
  • Start containers (skip WordPress prompt): sh bin/ -no-install
Install WordPress

Install WordPress with a few different options. The script will check if WordPress is already installed (www/wp-config.php file found). If it is, you will be asked if you want to reinstall. If WordPress isn't installed, it will proceed with the installation and then ask you whether you want to setup the DB or not.

Example: sh bin/


Execute WP CLI commands on the PHP container

Example: sh bin/ plugin list


Shell into the PHP container

Usage: sh bin/ or make shell


Execute composer commands on the root of the project in the PHP container

Example: sh bin/ install

Traefik Helper

Initiate Traefik on all projects defined in your docker-compose.yml file

Usage: sh bin/ up -d

Delete all containers

This will remove all container, but data will not be lost because it's stored on your hard drive

Usage: make prune

WordPress Multisites

To make multsites work, use a subdomain install and list subdomains in the docker-compose.yml frontend rule for nginx. For example: - 'traefik.frontend.rule=Host:viasatdealer.docker.localhost,test.viasatdealer.docker.localhost'

Alternatively, if you want to target all possible subdomains, you can comment out line 47 and uncomment line 48 in the docker-compose.yml. This will make other containers such as the phpmyadmin not work.


If you are using some sort of build workflow (Gulp/Webpack/Grunt) with BrowserSync, you have to use a temporary workaround. I'm still working on a viable solution to this.

In your BrowserSync config remove and reference to proxy/server. Then add the following code right before your closing </body> tag:

<script id="__bs_script__">//<![CDATA[
    document.write("<script async src='http://HOST:3000/browser-sync/browser-sync-client.js?v=2.18.13'><\/script>".replace("HOST", location.hostname));


If traefik won't start, make sure nothing is bound to port 80, such as Mac's internal apache, which can be stopped with sudo /usr/sbin/apachectl stop