Docker environment with WordPress, PHP-FPM, Apache, phpMyAdmin and MariaDB and SSL on localhost!
You can have multiple sites with a simple commands:
PROJECT=project1 ./start.sh
# This creates
project1/db
project1/pma
project1/wp-content
project1/wp-themes
project1/wp-wplogs
PROJECT=project2 ./start.sh
# This creates
project2/db
project2/pma
project2/wp-content
project2/wp-themes
project2/wp-wplogsEach PROJECT will have it's own Docker volume and services, but you you'll be able to keep only one group of services running because they use the same URL (wordpress.local).
Use it to develop your plugin or to have a LAMP stack to test some code.
You'll have:
Wordpress at https://wordpress.local phpMyAdmin at https://wordpress.local:3022
To run this, you just need to:
- Copy the
.env.exampleto a.envfile. - Adjust the env variables.
- Run
./start.sh
It'll do some things:
- Will edit your system
/etc/hostsso you'll be able to use https://wordpress.local for your WordPress - Will generate certificates with the Docker image alpine/mkcert
- Will insert the generated cert to your system "cert store".
That's it.
-
/wordpress- stores settings for the WP service. -
/phpmyadmin- stores settings for the phpmyadmin service. -
/wp-logs- stores the Apache logs from the WP service. -
/wp-plugins- it's where you put your plugins. Also, any plugins installed from WordPress will be present here. -
/wp-themes- it's where you put your themes. Themes intalled from WordPress will be present here too.
./.docker/wordpress/php/php.ini: https://github.com/php/php-src/blob/master/php.ini-development
- https://hub.docker.com/_/wordpress
- https://hub.docker.com/_/mariadb
- https://hub.docker.com/_/phpmyadmin
- https://hub.docker.com/r/alpine/mkcert
Import database
docker exec -i mariadb_{.ENV_PREFIX} \
mariadb \
--user=root \
--password=root \
< ./database.sql
Export all database
docker exec -i mariadb_{.ENV_PREFIX} \
mariadb-dump \
--user=root \
--password=root \
--all-databases \
> ./database.sql