Get Project Base
By Source Code
This can be done by cloning source code as below directly as well.
git clone https://github.com/wxqee/docker-wordpress-playground
And get into project directory.
cd docker-wordpress-playground/
Reference: wxqee/docker-wordpress-playground
Run Example
Go into directory local-example
cd local-example/
You can keep or update docker-compose.yml as you wish, and then start docker.
docker-compose up -d
After mysql and wordpress container starting done, check the container.
docker ps
and you can see something like below:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
86fa6d60469d wordpress:latest "docker-entrypoint..." 3 minutes ago Up 3 minutes 0.0.0.0:8000->80/tcp localexample_wordpress_1
d7575c796542 mysql:5.7 "docker-entrypoint..." 3 minutes ago Up 3 minutes 3306/tcp localexample_db_1
Oepn http://localhost:8000 from your browser.
Start Your Wordpress Life from here.
Something Addition
Any changes to the shared folders are about to take effects to your WordPress
environment.
- db_data/ folder is for mounting container mysql data folder, inited as empty folder.
- wordpress/ folder is for mounting container wordpress as source tree, inited as wordpress source code.
docker-compose.yml file contents is like below:
version: '3'
services:
db:
image: mysql:5.7
volumes:
- ./db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
depends_on:
- db
image: wordpress:latest
volumes:
- ./wordpress:/var/www/html
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
volumes:
db_data: