wordpress-in-docker

Command-line utility for local development with WordPress

Usage no npm install needed!

<script type="module">
  import wordpressInDocker from 'https://cdn.skypack.dev/wordpress-in-docker';
</script>

README

WordPress in Docker

Command-line utility for local development with WordPress.

Installation

npm install -g wordpress-in-docker

You need both Docker and Docker-Compose installed on your dev machine.

Use

The famous 1 command install

wpd init

Run this in your project directory. You will be prompted to supply a name for your WordPress theme. Then, it will pull the required Docker images, and configure them for development. This might take a little while the first time you run it.

Once it is ready, you should see the WordPress installation screen appear in your browser. A directory will have been created for your theme. You are ready to start development.

CLI reference

Usage: wpd [options] [command]

Options Description
-V, --version output the version number
-h, --help output usage information
Commands Description
init [options] Initialise a wordpress-in-docker project.
up Start up an existing wordpress-in-docker setup.
shell Spawn an interactive shell inside the WordPress container.
export [options] Export WordPress files and/or a database dump from the Docker containers to the host machine.

up

Start up an existing wordpress-in-docker setup.

Usage: wpd up

Options Description
-h, --help output usage information

init

Initialise a wordpress-in-docker project.

Usage: wpd init [options]

Options Description
-t, --theme <name> Create a blank WordPress theme with this name.
-h, --help output usage information

export

Export WordPress files and/or a database dump from the Docker containers to the host machine.

Usage: wpd export [options]

Options Description
-d, --database Create a blank WordPress theme with this name.
-w, --wordpress Create a copy of the WordPress directory.
-h, --help output usage information

References