A bare-bones starter WordPress environment using Docker. Right now, this just quickly sets up a functional local PHP environment and WordPress installation. Out of the box, the container comes installed with tools like Composer and the WP CLI.
How to Stand This Up
- Clone this repository into a directory.
- Navigate into that directory.
docker-compose upto turn on the container.
- If this is your first time using this environment, run
sh setup.sh(outside the running container -- no need to enter it). This will do the following things to get set up:
- Download & install WordPress.
- Enable WP debugging.
- Remove default posts, comments, and terms.
- Remove default plugins, themes, widgets.
- Install any dependencies you have noted in your
- After setup, navigate to http://localhost/wp-admin, where you'll be able to login with
passwordas the username & password.
- In the future, just turn on the container by running
docker-compose up. This will turn on the container and make the
/wordpressdirectory the web root, with the
contentdirectory being mounted inside of that. You should do all of your local development (themes, plugins, etc.) inside the
contentdirectory at the root of this project.
- When you're done, run
docker-compose downto turn off the container.
There are some other commands in the
Makefile too, so feel free to check those out or add your own.
Composer for Dependency Management
Composer is installed inside the container for easier dependency management, and a
composer.json file is included in the
wp-content. These are automatically installed on setup, but you can also install/update them manually using the following command:
docker-compose exec --user root php-fpm /bin/bash -c "cd wp-content && composer install"
Or, to update packages, use:
docker-compose exec --user root php-fpm /bin/bash -c "cd wp-content && composer update"
Mailcatcher is setup to trap emails sent from your application. View these emails by going to http://localhost:1080/.
Connect to SQL Database
You can use a tool like Sequel Pro to more easily see what's happening inside your database. To connect, use the following configuration:
Where do I put my projects?
Everything should go in the
content directory, which will be mounted to the container when it's turned on.
How do I modify the WordPress configuration?
Right now, directory modify the
wp-config.php file in the
How do I navigate the file system of the running container?
docker-compose exec --user root php-fpm /bin/bash, or use the
make bash shortcut (assuming
make is installed).
Can I change the server configuration?
Yes. In the
config directory, a
php.ini file exist for you to customize nginx & PHP as needed. These are mounted to the container when you turn it on.
How do I change the version of PHP?
docker-compose.yml file, change the tag in this line:
image: 10up/phpfpm:7.2. You can see a list of available tags here.
MIT © Alex MacArthur