WordPress with WP-CLI, XDebug and more out of the box.
4.9K
This project is a source of 200ms/wpapache_dev2 docker image.
200ms/wpapache_dev2 belongs to a set of images that can be described as "Dev^2 suit".
The idea behind this is to develop Docker images and complementing tools aimed to ease development and testing of LAMP applications.
The main goals are:
Wordpress is internet's number one web publishing software originally developed as a blogging platform in 2003, but nowadays being an advanced framework for building a web services. Image 200ms/wpapache_dev2 has been developed with purpose to support Wordpress development. It provides:
wp command)Apache server and Wordpress are pre-configured to support development, for instance 'WP_DEBUG' variable is set to 'true' to provide verbose messaging out of the box.
200ms/wpapache_dev2 can be launched as:
200ms/wpapache_dev2 provides Apache server and extra tools but database must be handled elsewhereUser can provide desired theme and plugin names, and also other parameters. Basing upon, container will perform setup automatically. If container is 'independent container' - hosting also database, there is no need to pass any database related information - container just starts as one (Wordpress and MariaDb).
Docker image can be pulled with:
docker pull 200ms/wpapache_dev2
Other images implementing that idea:
200ms/phpapache_dev2 - Apache server with XDebug pre-configured and more, in fact this image is derivative of 200ms/phpapache_dev2.200ms/mariadb_dev2 - MariaDB database with automatic DB creation and more200ms/prestashop_dev2 - Prestashop with helper scripts 200ms/wpapache_dev2 image has NOT been tested on other OS then Linux.
Therefore at this point only this OS is supported.This image internally uses Dev2FS that requires Linux FUSE
module to be loaded but also elevated privileges for each Docker container based on this image.
It might be required to modprobe fuse prior to using all features of the image.
Moreover it is required to run container with:
docker ... --cap-add SYS_ADMIN --device /dev/fuse ...
parameters. Or in the case of docker-compose.yaml:
services:
proj:
...
cap_add: ['SYS_ADMIN']
devices:
- /dev/fuse
...
This elevates container's permissions allowing FUSE based Dev2FS to work.
Dev2FS has been developed to fix mismatch of shared file permissions, therefore it is actually one of the key elements of Dev2 suit.
PHP code and other files must be shared between container and host. For 200ms/wpapache_dev2 directory named:
/code
has been chosen as a code share point. Data shared with /code is accessed by Apache server, additionally container will handle proper uid:gid remapping.
Launch empty WP installation:
mkdir app # see NOTE 3
docker run --cap-add SYS_ADMIN --device /dev/fuse \
--name "dev2wp_hithere" \
-it -p 8080:80 -v $(pwd)/app:/code \
200ms/wpapache_dev2
In above examples /code is shared with app directory. Before container launch app should be
an empty directory. At first run container will palace Wordpress files under this location. If there is something already under
app container will fail with Wordpress deployment.
docker compose up make sure to create directory that is to be shared. If missed Docker will create it but
with a root permissions, thus not too practical from project development perspective.To access Wordpress open: http://localhost:8080/
Credentials are printed at the console right after container launch:
************************* ...
* Login credentials:
admin / TEST0ff7cc
************************* ...
or, if it has not been noted it can be reset with:
docker exec -it dev2wp_hithere wp-ext resetpass
To install WP with a certain plugins and selected theme:
docker run --cap-add SYS_ADMIN --device /dev/fuse \
--name "wp_dev2" \
-e WP_THEME_ACTIVATE="newsup" \
-e WP_PLUGIN_LIST="smart-grid-gallery" \
-e SITETITLE="WP test 2" \
-it -p 8080:80 -v $(pwd)/app:/code \
200ms/wpapache_dev2
or, if already prepared MySQL DB is somewhere in a network:
docker run --cap-add SYS_ADMIN --device /dev/fuse \
--name "wp_dev2_extdb" \
-e MYSQL_HOST=mydbhost.local
-e DB_NAME=wp -e DB_USER=wpuser -e DB_PASS=notgoodidea
-e WP_THEME_ACTIVATE="newsup" \
-e WP_PLUGIN_LIST="smart-grid-gallery" \
-e SITETITLE="WP test 2 ext db" \
-it -p 8080:80 -v $(pwd)/app:/code \
200ms/wpapache_dev2
Feature to come soon.
Below the list of environment variables that can be used to instruct Wordpress deployment.
Space or comma separated list of themes for installation. Theme that is provided as first on the list will become an active one.
But if WP_THEME_ACTIVE is set the theme indicated in this variable will become active.
Theme path.
Name of the theme to be activated. This name does not need to be listed in WP_THEME_LIST nor be a name of WP_THEME_PATH theme.
If missing appropriate theme will be searched for installation and activation.
Space or comma separated list of plugins for installation, plugins are automatically activated.
Space or comma separated list of plugins that should be installed but not activated. If plugin name is listed
in both WP_PLUGIN_INACT_LIST and WP_PLUGIN_LIST it will be installed and not activated - the same action as it would
be listed in WP_PLUGIN_INACT_LIST only.
If set to yes, y or 1 prepare multisite Wordpress installation. Default not set.
Blog's site title
Blog's description
Admin's user name
Admin's email
If MYSQL_HOST variable is not set, or set to indicate localhost, Wordpress will be configured for using internal (in the same container) MySQL database.
In order to use an external database, MYSQL_HOST should be set to point other host then 'localhost'.
Set database root password, if container uses internal database and this variable is skipped, a random password will be generated.
Database user name if not set default 'user' is used.
Password for given user name, if not set random password is generated.
Name of the MySQL database to be used by Wordpress, if omitted 'mydb' is set.
Example WordPress deployment here - YouTube.
200ms tools YouTube channel click.
Content type
Image
Digest
sha256:0f706d66e…
Size
399.4 MB
Last updated
11 months ago
docker pull 200ms/wpapache_dev2