James Swineson's WordPress variant. Suitable if you:
- use a low-end Docker public cloud service
- is migrating an old WordPress installation to Docker
- need to put the whole WordPress installation dir into a volume
- and still needs auto upgrading
Runtime:
- Apache 2
- PHP 7
Preinstalled:
- WordPress
- wp-cli
- some useful Apache modules
- some useful PHP modules
Please mount /var/www/html
as a volume.
WORDPRESS_ROOT
: the path you want to install WordPress (if not exist) to. Defaults and relative to/var/www/html
.WORDPRESS_DB_HOST
,WORDPRESS_DB_USER
,WORDPRESS_DB_PASSWORD
: MySQL things.WORDPRESS_FIX_PERMISSION
: set to chmod everything to a correct permission. Needed if you are migrating or some directory is not able to be written by WordPress. May take >6hrs on a large site. Don't set it on every container start.WORDPRESS_NO_INSTALLATION
: explicitly skip WordPress detection and auto-installation. Useful if you want a clean LAMP environment.WORDPRESS_UPDATE
: set to upgrade WordPress and all plugins on container start.WORDPRESS_BEHIND_REVERSE_PROXY
: Set to use Apache2's mod_remoteip to parse correct ip if behind a reverse proxy. Also setWORDPRESS_REVERSE_PROXY_HEADER
to your reverse proxy's IP header (defaults toX-Forwarded-Proto
) andWORDPRESS_REVERSE_PROXY_ADDR
to your reverse proxy's IP address (or CIDR or domain).
You may run into problems like WordPress loading all assets over HTTP or redirect loop in /wp-login.php
. To solve this, add the following code to the top of /wp-config.php
right below <?php
tag:
// enable HTTPS detection behind proxy
define('FORCE_SSL_ADMIN', true);
// in some setups HTTP_X_FORWARDED_PROTO might contain
// a comma-separated list e.g. http,https
// so check for https existence
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';
See Administration Over SSL for more information on this.
If you cannot visit any static links (they should be 404), please add a .htaccess
file to the site root using content from htaccess.
If you use Wordfence WAF or any other security plugin, you may need to redo setup of them.
Everything else should work.
==============
This is the Git repo of the Docker official image for wordpress. See the Docker Hub page for the full readme on how to use this Docker image and for information regarding contributing and issues.
The full readme is generated over in docker-library/docs, specifically in docker-library/docs/wordpress.
See a change merged here that doesn't show up on the Docker Hub yet? Check the "library/wordpress" manifest file in the docker-library/official-images repo, especially PRs with the "library/wordpress" label on that repo. For more information about the official images process, see the docker-library/official-images readme.