This docker-compose environment allows you to run a matrix of PHP, MySQL, WordPress and WooCommerce configurations, for example:
PHP | MySQL | WordPress | WooCommerce | Multisite |
---|---|---|---|---|
5.4 | 5.6 | 4.7 | 3.2.6 | 0 |
5.5 | 5.7 | 4.8 | 3.3.5 | 1 |
5.6 | 8.0 | latest | 3.4.4 | |
7.0 | nightly | latest | ||
7.2 | http://beta.url |
- Docker >= 1.8.3
- Docker Compose
See Docker.com for more information. You can install Docker directly from Docker installation page
- Make a new project folder and clone (or download) the WooCommerce Development Docker repository:
$ mkdir my-plugin && cd my-plugin
$ git clone https://github.com/kilbot/WooCommerce-Dev-Docker.git ./docker
- Populate your plugin files, either from an existing project or perhaps using a WordPress Plugin Boilerplate.
Copy the
.env
andfixtures.yml
files from the .docker directory.
$ cp .docker/.env.example .env
$ cp .docker/fixtures.example.yml fixtures.yml
At a minimum you should now have a my-plugin
folder with the structure below:
my-plugin/
+-- .docker
+-- .env
+-- fixtures.yml
+-- index.php
+-- readme.txt
- Start the containers (and watch container logs)
$ docker-compose -f .docker/docker-compose.yml up -d
$ docker-compose -f .docker/docker-compose.yml logs -f --tail=10
- Go to http://localhost and log into WordPress with the following credentials:
user: admin
password: password
The first build may take some time to complete, if you can not access http://localhost try again after 5-10 minutes.
The .env
file contains the default settings for the docker containers.
Dummy data is created using the fixtures.yml
template.
$ docker-compose -f .docker/docker-compose.yml up -d
$ docker-compose -f .docker/docker-compose.yml logs -f --tail=10
$ docker-compose -f .docker/docker-compose.yml kill
$ docker ps
$ docker exec -it <CONTAINER ID or CONTAINER NAME> bash
$ docker system purge -fa
or
$ docker system prune -fa
$ rm -rf .docker/.db && rm -rf .docker/.html