Dockerize WordPress on Mac/Windows

Preview:

Citation preview

DOCKERIZE WORDPRESS

ON MAC/WINDOWSWordCamp Kansai 2016

WordPress core contributor

Ruby on Rails contributor

Wocker developer

Bathe developer

Frasco developer

Web & graphic designer

Programmer

KiteKITERETZ inc. CEO & Funder

! kite.koga " ixkaito # ixkaito

HOW MANY PEOPLE

KNOW DOCKER?

HOW MANY PEOPLE

HAVE USED DOCKER?

WHAT IS DOCKER?

PACKAGE YOUR APPLICATION INTO A

STANDARDIZED UNIT FOR SOFTWARE

DEVELOPMENTDocker containers wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries – anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment.

- Lightweight- Open- Secure by default

ADVANTAGES OF DOCKER

COMPARING

CONTAINERS AND

VIRTUAL MACHINES

VIRTUAL MACHINESVirtual machines include the application, the necessary binaries and libraries, and an entire guest operating system -- all of which can amount to tens of GBs.

DOCKER (CONTAINERS)

Containers include the application and all of its dependencies --but share the kernel with other containers, running as isolated processes in user space on the host operating system. Docker containers are not tied to any specific infrastructure: they run on any computer, on any infrastructure, and in any cloud.

VIRTUAL MACHINES DOCKER (CONTAINERS)

HOW TO USE DOCKER

ON MAC/WINDOWS?

1. VIRTUALBOX + VAGRANT

Boot2Docker RancherOS Barge OS

Version 1.11.2 0.4.5 2.1.5

Size 35 MB 31 MB 13 MBKernel 4.4.12 4.2.8 4.4.14

User Land Tiny Core Linux v7.1 Buildroot(glibc) + BusyBox v1.24.1 Buildroot(glibc) + BusyBox v1.24.2

Docker 1.11.2 1.10.3 1.9.1~Storage Driver aufs, etc. overlay, etc. overlay

TLS ✓ ✓ ✓Vagrant box (Third party) 0.4.1 ~ 0.4.3 ✓

VirtualBox SF 5.0.20 - 5.0.24NFS Mount (Third party) (rsync) ✓

xhyve ✓ ✓ ✓

Boot Time ~ 15s ~ 15s 5s ~ 10s

LIGHTWEIGHT DOCKER HOSTS FOR VAGRANT

https://gist.github.com/ailispaw/da3ea53c1f42569770e0

2. DOCKER TOOLBOX

WHAT’S IN THE TOOLBOX- Docker Engine- Docker Compose- Docker Machine- Kitematic

KITEMATIC- Docker GUI- Fast and Easy Setup- Docker Hub Integration- Seamless Experience Between

CLI and GUI

3. DOCKER FOR MAC/WINDOWS

WHAT’S IN DOCKER FOR MAC/WINDOWS- Docker Engine- Docker CLI Client- Docker Compose- Docker Machine

HOW TO DOCKERIZE

WORDPRESS?For development only (without Docker Compose)

DOCKERFILE, DOCKER IMAGE,

AND DOCKER CONTAINER- Write Dockerfiles- Build Docker images from Dockerfiles- Run Docker containers from Docker images

WHAT DO WE NEED IN DOCKER IMAGES- Web server- PHP- MySQL- WordPress Core- WP-CLI (recommended)

BEST PRACTICES FOR WRITING DOCKERFILES- Containers should be ephemeral- Use a .dockerignore file- Avoid installing unnecessary packages- Run only one process per container- Minimize the number of layers- Sort multi-line arguments- Build cache

FROM A DOCKERFILE

https://github.com/wckr/wordpress-dockerfile

$ docker build https://github.com/wckr/wordpress-dockerfile.git

FROM DOCKER HUB

DOCKER HUBDocker Hub is a cloud hosted service from Docker that provides registry capabilities for public and private content.

USING DOCKER CLI

$ docker pull wocker/wordpress

FROM KITEMATIC

THANK YOU!

Recommended