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_PASSWORDMYSQL_HOST=db:MYSQL_PORT=3306:MYSQL_USER=rootMYSQL_PASSWORD=rootMYSQL_DATABASE=wpWORDPRESS_URL=wordpressWORDPRESS_TITLE=WordPress siteWORDPRESS_ADMIN_USER=adminWORDPRESS_ADMIN_PASSWORD=adminWORDPRESS_ADMIN_MAIL=admin@example.com