Wordpress + Docker + Github

Mon, Jul 13, 2015 One-minute read

Working with Wordpress and Git for me has been a challenge. Ideally I want to keep just my plugins and theme in version control and keep all the Wordpress files (that I would never edit) seperate. You can accomplish this manually but how would this work if you are using Docker for local development?

Docker.. actually makes this easy and quite elegant.

With Docker you are able to leverage the Wordpress container and just have your theme and plugins in version control. Amazing.

Below is the docker-compose file, a project template using this can be found in this github repo.

Example docker-compose File:

  image: wordpress:4.2.2-apache
    - db:mysql
    - "3000:80"
    - plugins/:/var/www/html/wp-content/plugins
    - themes/:/var/www/html/wp-content/themes
  image: mariadb

image This pulls a specific version of wordpress. Use this to match whatever you are developing against. The list of available versions can be found in the docker registry

volumes This mounts your plugin folder at the correct location within the container.

That is all!