From 8642947a726d1e18f1a73caf4dafb51d4ab692a0 Mon Sep 17 00:00:00 2001 From: Sven Koschnicke Date: Mon, 21 Aug 2017 10:39:52 +0200 Subject: [PATCH] Added WORDPRESS_DB_PASSWORD_FILE to readme resolves issue #225 --- wordpress/content.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wordpress/content.md b/wordpress/content.md index b4156cfe1..69b6c4e43 100644 --- a/wordpress/content.md +++ b/wordpress/content.md @@ -17,12 +17,19 @@ The following environment variables are also honored for configuring your WordPr - `-e WORDPRESS_DB_HOST=...` (defaults to the IP and port of the linked `mysql` container) - `-e WORDPRESS_DB_USER=...` (defaults to "root") - `-e WORDPRESS_DB_PASSWORD=...` (defaults to the value of the `MYSQL_ROOT_PASSWORD` environment variable from the linked `mysql` container) +- `-e WORDPRESS_DB_PASSWORD_FILE=...` (for use with Docker secrets, see below) - `-e WORDPRESS_DB_NAME=...` (defaults to "wordpress") - `-e WORDPRESS_TABLE_PREFIX=...` (defaults to "", only set this when you need to override the default table prefix in wp-config.php) - `-e WORDPRESS_AUTH_KEY=...`, `-e WORDPRESS_SECURE_AUTH_KEY=...`, `-e WORDPRESS_LOGGED_IN_KEY=...`, `-e WORDPRESS_NONCE_KEY=...`, `-e WORDPRESS_AUTH_SALT=...`, `-e WORDPRESS_SECURE_AUTH_SALT=...`, `-e WORDPRESS_LOGGED_IN_SALT=...`, `-e WORDPRESS_NONCE_SALT=...` (default to unique random SHA1s) If the `WORDPRESS_DB_NAME` specified does not already exist on the given MySQL server, it will be created automatically upon startup of the `%%REPO%%` container, provided that the `WORDPRESS_DB_USER` specified has the necessary permissions to create it. +As an alternative to passing the database password via environment variables, `WORDPRESS_DB_PASSWORD_FILE` may be used instead of `WORDPRESS_DB_PASSWORD`, causing the initialization script to load the password from a file present in the container. In particular, this can be used to load passwords from Docker secrets stored in `/run/secrets/` files. For example: + +```console +$ docker run --name some-%%REPO%% -e WORDPRESS_DB_PASSWORD_FILE=/run/secrets/db_password -d %%REPO%% +``` + If you'd like to be able to access the instance from the host without the container's IP, standard port mappings can be used: ```console