Docker: WordPress Playground (5 minutes)

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.

  1. db_data/ folder is for mounting container mysql data folder, inited as empty folder.
  2. 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:
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值