Basic Docker configuration for local WordPress development
- Apache
- MariaDB
- PHP
- WP-CLI
- phpMyAdmin
- The optional
.envfile serves as a template using default values UIDandGID: Set to the current operating system user values to avoid filesystem permission issuesWP_PORTandPMA_PORT: Override the default ports for WordPress and phpMyAdmin- A compatible
wp-config.phpwill be generated if one does not already exist - The optional
wp-config-local.phpcan be used for supported installs wherewp-config.phpis tracked
- Add
compose.yamlto the root of the local WordPress install - Start:
docker compose up -d - Visit any
localhostaddress (http://localhost, http://site.localhost, etc) - Stop:
docker compose down
docker compose run --rm wp-cli [command][command]can be any WP-CLI command (--info,media regenerate, etc)
- phpMyAdmin can be accessed at any
localhostaddress on port 8888 (http://localhost:8888, http://site.localhost:8888, etc) - Login credentials are
root:rootorusername:password
- The optional
.htaccessfile can be used to automatically load missing assets from another URL https://example.comcan be changed to the live URL to avoid having to pull down assets for local development- These directives should always come before the WordPress block