Skip to content

Docker environment for WordPress development with PHP, Apache, phpMyAdmin and MariaDB.

License

Notifications You must be signed in to change notification settings

srbrunoferreira/docker-wordpress

Repository files navigation

docker-php-fpm-apache-phpmyadmin-mariadb

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-wplogs

Each 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

Setup

To run this, you just need to:

  1. Copy the .env.example to a .env file.
  2. Adjust the env variables.
  3. Run ./start.sh

About start.sh

It'll do some things:

  1. Will edit your system /etc/hosts so you'll be able to use https://wordpress.local for your WordPress
  2. Will generate certificates with the Docker image alpine/mkcert
  3. Will insert the generated cert to your system "cert store".

That's it.

About the folders

  • /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.

Reference

Docker images used

Useful commands

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 

About

Docker environment for WordPress development with PHP, Apache, phpMyAdmin and MariaDB.

Topics

Resources

License

Stars

Watchers

Forks