Docker WordPress Scripts
DWS is a small set of scripts to manage WordPress containers in Docker. It uses an nginx-proxy for
*.localhost domains to avoid manual port assignment.
This is work in progress and unstable!
- Docker must be installed and running on your machine.
80must be unbound for the proxy server to work.
npm init if you don't have a
docker-wordpress-scripts to the project repository:
npm install docker-wordpress-scripts --save
Or use the
--global flag to use
dws commands anywhere without
Usage: dws <command> [options] Commands: dws up [proxy] spin up a new project dws stop stop running containers dws start start existing containers dws url output the *.localhost URL dws down [proxy] stop and remove existing containers dws eject replace DWS dependency with config files Options: --help, -h Show help --version, -v Show version number
npx dws up
DWS will spin up new Docker containers and install WordPress. You'll be asked a few configuration values.
Once successful you'll see:
🐹 Success: WordPress is up and running! ➜ http://wordpress.localhost
wp-content directory is mounted to
wordpress in the project repository. The entire database is mounted to
_database (advisable to add to
phpMyAdmin is also set up on the
dws up --proxy to spin up the NGINX proxy. This happens automatically when a project is set up.
npx dws stop
Stop all running containers for the project.
npx dws start
Start all existing containers for the project.
npx dws url
*.localhost URL for the project.
npx dws down
Stop and remove all containers for the project leaving no trace in Docker. The database and WordPress content directories will persist in the project repository. Unless they are deleted the
init command can restore the project.
dws down --proxy to stop and remove the NGINX proxy.
npx dws eject
Remove the DWS dependency. There is no going back! This adds a copy of
docker-compose.yml and other config files to the project repository. You can continue by using
docker-compose in the terminal.
The hostname & port for WordPress and phpMyAdmin moves to respectively:
Using the NGINX Proxy
The proxy set up by DWS is not exclusive and can be used for other projects. Use the external Docker network
VIRTUAL_PORT environment options for the service.
An instance of Portainer is also created behind the NGINX proxy. To configure visit: