Skip to content

Repository files navigation

Docker WordPress

A simple Docker environment for creating a WordPress plugin or theme

This is the minimal setup you need to get a local WordPress development environment up and running quickly. This makes it easy to create a plugin or theme. Use it to run a modern version of WordPress on an currently supported version of PHP.

Version

The current version is 0.1.0. This project uses semantic versioning.

Features

  • Based on WordPress on 6.9 and PHP 8.3
  • Quick Setup of a new WordPress Environment

Ideas for sections/pages

  • Language Translations
  • Frequently Asked Questions (FAQ)
  • Screenshots
  • Submit Issues

Docker Commands

  • Run docker compose up -d to start your containers
  • Run docker compose down to stop your containers and keep your data
  • Run docker compose down -v to stop your containers and destroy your data

WordPress CLI

The WP-CLI interface has been added to the compose.yaml file. This makes it easier to administer a WordPress install.

The service name wpcli is needed to direct your commands to the right place. The rest of the command is passed to WP-CLI for processing.

Retrieve a list of all plugins, and show their status.

$ docker compose run --rm wpcli plugin list

Show the version info and program install locations.

$ docker compose run --rm wpcli --info

Show the web address (URL) of your website. Note: In a docker environment, the wpcli admin command isn't useful, since it can't open the browser on your host. Instead, use this command to print the siteurl value, and copy/paste it into your browser.

docker compose run --rm wpcli option get siteurl

The media-sizes package has been installed for your convenience. You may want to browse the available packages to see what else interests you.

docker compose run --rm wpcli media sizes

Copy the wp-config.php to your host from within the container.

docker compose cp wordpress:/var/www/html/wp-config.php ./wp-config.php

Copy the WordPress code to your host from within the container. Sometimes you want to read the WordPress core code.

docker compose cp wordpress:/var/www/html ./wp-code

Create a WordPress plugin, prompting for certain field values.

dot:docker wpcli scaffold plugin <slug> --activate --prompt=plugin_name,plugin_description,plugin_author,plugin_author_uri

Use the mkplugin.bash script to simplify creation of new plugins. This allows you to hard-code some values, while prompting for others. This is optional. It's just here for your convenience

Check out a list of WP-CLI commands to see what it can do. Review the WP-CLI Handbook for access to additional resources.

Installation

  • Clone this template repo from Github
  • Run docker compose up -d
  • Access the site at http://localhost:8080
  • Complete the standard WordPress Install process
  • Create a Git Ignore file
    • Add the phpdocs directory to your .gitignore file
    • Add Editor-specific files to your .gitignore ( .swp for Vim, .idea for PHPStorm, etc. )
  • Select an Open Source License and copy it to LICENSE.txt
  • Update CONTRIBUTING.md to match your project needs

Optional Installation

Resources

WordPress

General

Credits and Acknowledgments

About

Create a local WordPress development environment using Docker. Includes WP-CLI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages