Docker with wordpress

UPDATE (2018-05-11):

Our team at LodeStream has built a scaffold specifically for Wordpress development. You can check it out today and start play with it. Out of the box, it supports:

  • Docker, Docker Compose
  • Let’s encrypt HTTPS
  • Nginx as a reverse proxy with auto generated config
  • Simplified domain configuration
  • More information in the repo

Github repo: lodestreams/wordpress-docker-compose

The original post:

Install Docker on a Ubuntu:

Docker installation guide:

If you don’t know about datastore yet, refer to:

  • sudo docker create -v "$PWD":/var/lib/mysql --name dbstore mysql
  • sudo docker create -v "$PWD":/var/www/html --name htmlstore php
  • sudo docker run --name mysql -e MYSQL_ROOT_PASSWORD=password --volumes-from=dbstore -dp 3306:3306 mysql
  • git clone
  • sudo docker run -d --name wordpress --link mysql:mysql --volumes-from=htmlstore -p 80:80 youdar/wordpress
  • sudo docker run -d --link mysql:mysql -e MYSQL_USERNAME=root --name phpmyadmin -p 3307:80 corbinu/docker-phpmyadmin


添加新的 Wordpress 网站:

使用现有的 MySQL 数据库。

  • sudo docker create -v "$PWD":/var/www/html --name wordpressNameStore php
  • sudo docker run -d --name wordpressName --link mysql:mysql --volumes-from=htmlstore -p 800x:80 youdar/wordpress


  • Remove dangling volumes: sudo docker volume ls -f dangling=true | awk 'FNR > 1 {print $2}' | xargs sudo docker volume rm
  • Run a nginx at current dir: sudo docker run -it --rm -v "$PWD":/usr/share/nginx/html -p 8081:80 nginx

  • sudo docker inspect --format="" nginx | json_pp

Read More