Docker Wordpress is a starter project to get started quickly with a fresh install of Wordpress, MySQL and WP CLI. It can be forked and customized for personal builds or for client sites.
Ensure that you have Homebrew and Homebrew Cask installed before proceeding.
# Install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install caskroom/cask/brew-cask
brew cask install virtualbox
brew install docker docker-machine
brew install wp-cli
- Duplicate
.sample-env
to.env
and update for your application - Start Wordpress, MySQL and code-server with
docker-compose up -d
. (To stop the container usedocker-compose stop
.) - Open a browser
http://localhost:<port_selected>
and finish setting up Wordpress.
Note: MySQL databases and schema for Wordpress will be automagically synced into the folder db/mysql
You can run WP CLI commands through the Docker container using Docker Compose and prefixing all commands with this: docker-compose run --rm wpcli
. Using wpcli
at the end is merely the name of the Docker image that is installed in docker-compose.yml
. You can change this to be anything to make it easier to remember.
Note: Full list of commands is listed on the WP CLI Commands page.
docker-compose run --service-ports --rm wpcli
docker-compose run --service-ports --rm wpcli post list1