Having one version of PHP or one database instance on your system is annoying and risky when working on multiple projects. Do you need a different WP or PHP version for one project? Did one project break another? Stop crying and use this Docker template.
By just having a Docker environment per project it makes your life easier, jump around between WP/PHP versions and make adjustments per project with ease. Create a snapshot, trash and/or restore things without touching your other projects.
- WordPress, you didn't expect that, did you?
- phpMyAdmin for easy moderation of your database
- MariaDB to store your data
- Make sure you have Docker installed and the daemon is running
- Clone or download this repo to a new project folder
- Copy the
example.env
file to.env
and keep it in your project folder, you can adjust your settings here - Run the development environment for the first time with
docker-compose up -d
, it will create the folder structure - Move your plugins and themes into the created folders
- Optionally open phpMyAdmin on http://127.0.0.1:1234 to import your project data
- Open your project on http://127.0.0.1:8080
- Start the development server as a detached background process:
docker-compose up -d
- Turn off your development server, when running in the background:
docker-compose down
- Check if your server is running in the background? With
docker ps
you can see all running services - Development server showing all container logs:
docker-compose up
, exit withctrl + c
- You can adjust the WordPress database prefix and debug mode from the env configuration file
- Development server: http://127.0.0.1:8080
- phpMyAdmin: http://127.0.0.1:1234
- MariaDB database:
127.0.0.1:3306
Note: make sure to run the docker-compose
commands from within your project directory.
Open up the .env
file, you can find all the settings there. If you can't find it, copy the example.env
and rename it to .env
.
This can be done in the .env
file by switching the tag of the WordPress Docker image, overview of supported tags.
You can connect to your IP 127.0.0.1
on port 3306
.
Any thoughts for improvements or having some issues? Please let me know if you have any feedback by creating an issue. Thanks!