Automatically download, configure, install and run WordPress thanks to WP-CLI.
Warning: WordPress is launched wih the PHP's built-in web server. It is not intended to be a full-featured web server. It should not be used on a public network.
The simplest is to use docker compose:
docker-compose up -d
This launch two containers:
web
: the WordPress installation itself, from theDockerfile
,db
: the official mysql container.
When you start the containers with docker-compose
, you can adjust the configuration in the .env
file (see “Environment Variables” for possible values).
docker build -t wp .
docker run -d -e MYSQL_HOST=<host> -e MYSQL_USER=<username> -e MYSQL_PASSWORD=<password> -e MYSQL_DATABASE=<database for wordpress>
When you start the containers with docker-compose
, you can set environment variables with -e <NAME>=<VALUE>
parameters.
MYSQL_ROOT_PASSWORD
MYSQL_HOST=db
:MYSQL_PORT=3306
:MYSQL_USER=root
MYSQL_PASSWORD=root
MYSQL_DATABASE=wp
WORDPRESS_URL=wordpress
WORDPRESS_TITLE=WordPress site
WORDPRESS_ADMIN_USER=admin
WORDPRESS_ADMIN_PASSWORD=admin
WORDPRESS_ADMIN_MAIL=admin@example.com