1 of 34

PRESENTATION

Using Docker to Create WordPress Development Environments 2.0

WordCamp Ottawa 2017

July 22nd, 2017

Thiago Loureiro

thiago@tloureiro.com

@th_loureiro

2 of 34

About Me

3 of 34

Development Environments

XAMPP

EasyPHP

WampServer

Mamp

AMPPS

Bitnami

ServerPress

​

​

​

Virtual Machine

​

​

Vagrant

VVV

​

​

Manual

Host Install

​

​

​

Docker

​

�"I just FTP to the server"

4 of 34

Dev Environment Problems

​

​

​

The deadly server configuration change.

5 of 34

Dev Environment Problems

​

​

​

Where is the database?!

6 of 34

Dev Environment Problems

​

​

​

Cloning a dev environment

7 of 34

Dev Environment Problems

​

​

"I'm going to close some tabs to free up some memory"

8 of 34

Dev Environment Problems

​

​

​

Fear of upgrading

9 of 34

Dev Environment Problems

​

​

​

"How will I build it again?"

10 of 34

Dev Environment Problems

​

​

WP version vs PHP version vs PHP configuration vs Server type vs Server version vs Server configuration vs Installed extensions vs Operating System vs...

11 of 34

Key Facts About Docker

  • Open sourced in 2013
  • Written in Go

12 of 34

Key Facts About Docker

contributors:

13 of 34

Key Facts About Docker

used by:

14 of 34

What Is Docker?

"Docker is a container platform."

15 of 34

….and what is a container?

"A container image is a lightweight, stand-alone, executable package of a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, settings."

16 of 34

simple version please.

  • It's a package that contains a piece of software
  • This package contains everything needed to run it, nothing more, nothing less.

17 of 34

OS Virtualization vs. Containers

< memory hogging ide >

18 of 34

Demo

apache container demo

19 of 34

Demo

docker run --name my-apache-app -p 80:80 -v "$PWD":/usr/local/apache2/htdocs/ httpd:2.4

​

​

user defined name

host port : container port

host folder : container folder

container image name : version

20 of 34

The Docker Hub

https://hub.docker.com/explore/

21 of 34

The Official Wordpress Image

php:5.6-apache

​

scratch

debian:jessie

Wordpress

22 of 34

The Official Wordpress Image

mysql

​

scratch

debian:jessie

php:5.6-apache

​

scratch

debian:jessie

Wordpress

HOST KERNEL

23 of 34

A disposable wordpress install

​

​

(code available at https://github.com/tloureiro/wp-docker-presentation)

24 of 34

A disposable wordpress install (on steroids)

​

​

​

​

(code available at https://github.com/tloureiro/wp-docker-presentation)

25 of 34

Docker Compose

26 of 34

Docker Compose

27 of 34

Demo - Version 1 - WP + DB

28 of 34

Demo - Version 2 - WP + DB + Volumes

29 of 34

Demo - Version 3 - WP + DB + Volumes + phpMyAdmin

30 of 34

Demo - Version 4 - WP + DB + Volumes + phpMyAdmin + extended image

31 of 34

Multi Container vs Single/Fat Container

wordpress

+

apache

+

php

database

alpine linux

nginx

mariadb

php

wordpress

wp-cli

nano

php-imagick

xdebug

phpmyadmin

32 of 34

Some alternatives

https://github.com/visiblevc/wordpress-starter

https://github.com/10up/wp-local-docker

33 of 34

Some alternatives

https://github.com/autopilotpattern/wordpress

34 of 34

the end

Before Docker

After Docker

WordCamp Ottawa 2017

July 22nd, 2017

Thiago Loureiro

thiago@tloureiro.com

@th_loureiro