WordPress docker image based on Alpine Linux
10K+
WordPress setup for Docker, build on Alpine Linux. The image is only +/- 70MB large.
Repository: https://github.com/erseco/alpine-wordpress
docker logs -f <container name>)Start the Docker containers:
docker-compose up
Login on the system using the provided credentials (ENV vars)
In certain situations, you might need to run commands as root within your WordPress container, for example, to install additional packages. You can do this using the docker-compose exec command with the --user root option. Here's how:
docker-compose exec --user root wordpress sh
Below is a docker-compose.yml example specifically designed for WordPress plugin development. This configuration provides a comprehensive setup for developing, testing, and deploying WordPress plugins efficiently.
services:
mariadb:
image: mariadb:latest
restart: unless-stopped
environment:
- MYSQL_ROOT_PASSWORD=wordpress
- MYSQL_DATABASE=wordpress
- MYSQL_USER=wordpress
- MYSQL_PASSWORD=wordpress
volumes:
- mariadb:/var/lib/mysql
wordpress:
image: erseco/alpine-wordpress:latest
restart: unless-stopped
depends_on:
- mariadb
ports:
- 8080:8080
environment:
WP_LANGUAGE: es_ES
WP_ADMIN_USERNAME: admin
WP_ADMIN_PASSWORD: PLEASE_CHANGEME
WP_DEBUG: true
WP_PLUGINS: user-access-manager
WP_SITE_URL: http://localhost:8080
POST_CONFIGURE_COMMANDS: |
echo "Creating user for testing"
if ! wp user get test1 --field=ID --quiet; then
wp user create test1 [email protected] --role=subscriber --user_pass=test1
fi
echo "Activating plugin"
wp plugin activate my-plugin
volumes:
- wordpress:/var/www/html
- ./my-plugin:/var/www/html/wp-content/plugins/my-plugin
volumes:
mariadb: null
wordpress: null
erseco/alpine-wordpress:latest, tailored for WordPress development../my-plugin.mariadb service for database connectivity.docker-compose.yml in your project directory.my-plugin in the same location.docker-compose up -d in your terminal, within the project directory.http://localhost:8080 to test and develop your plugin in a real-world environment.This setup streamlines the plugin development process, from coding and testing to deployment, within a controlled and consistent environment.
Define the ENV variables in docker-compose.yml file
| Variable Name | Default | Description |
|---|---|---|
| WP_LANGUAGE | en_US | WordPress site language |
| DB_HOST | mariadb | Database host |
| DB_PORT | 3306 | MySQL default port |
| DB_NAME | wordpress | Database name |
| DB_USER | wordpress | Database user |
| DB_PASSWORD | wordpress | Database password |
| DB_PREFIX | wp_ | Database prefix for WordPress tables |
| WP_ADMIN_EMAIL | [email protected] | WordPress admin email |
| WP_ADMIN_USERNAME | admin | WordPress admin username |
| WP_ADMIN_PASSWORD | PLEASE_CHANGEME | WordPress admin password |
| WP_DEBUG | false | Enable/disable WordPress debugging |
| WP_CLI_CACHE_DIR | /tmp/wp-cli/cache/ | WP-CLI cache directory path |
| WP_THEME | Active WordPress theme | |
| WP_PLUGINS | Comma-separated list of WordPress plugins | |
| WP_SITE_TITLE | WordPress Site | Title of the WordPress site |
| WP_SITE_DESCRIPTION | Just another WordPress site | Description of the WordPress site |
| WP_SITE_URL | http://localhost:8080 | WordPress site URL |
| client_max_body_size | 50M | Maximum allowed size of client request bodies |
| post_max_size | 50M | Maximum size of POST data that PHP will accept |
| upload_max_filesize | 50M | Maximum size of an uploaded file |
| max_input_vars | 5000 | Maximum number of input variables for PHP |
| zlib_output_compression | Off | Disable zlib compresion for PHP |
| PRE_CONFIGURE_COMMANDS | Commands to run before starting the configuration | |
| POST_CONFIGURE_COMMANDS | Commands to run after finished the configuration |
Content type
Image
Digest
sha256:7caf797e8…
Size
99.1 MB
Last updated
1 day ago
docker pull erseco/alpine-wordpress