Skip to content

Commit be44d78

Browse files
authored
Merge pull request #1911 from infosiftr/wpcli
Adjust WP-CLI docs for our customized `wp-config.php`
2 parents ee082ef + a984afb commit be44d78

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

wordpress/variant-cli.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ The simplest way to use it with an existing WordPress container would be somethi
88
$ docker run -it --rm \
99
--volumes-from some-wordpress \
1010
--network container:some-wordpress \
11-
wordpress:cli user list
11+
-e WORDPRESS_DB_USER=... \
12+
-e WORDPRESS_DB_PASSWORD=... \
13+
# [and other used environment variables]
14+
%%IMAGE%%:cli user list
1215
```
1316

1417
Generally speaking, for WP-CLI to interact with a WordPress install, it needs access to the on-disk files of the WordPress install, and access to the database (and the easiest way to accomplish that such that `wp-config.php` does not require changes is to simply join the networking context of the existing and presumably working WordPress container, but there are many other ways to accomplish that which will be left as an exercise for the reader).
18+
19+
**NOTE:** Since March 2021, WordPress images use a customized `wp-config.php` that pulls the values directly from the environment variables defined above (see `wp-config-docker.php` in [docker-library/wordpress#572](https://github.com/docker-library/wordpress/pull/572) and [docker-library/wordpress#577](https://github.com/docker-library/wordpress/pull/577)). As a result of reading environment variables directly, the cli container also needs the same set of environment variables to properly evaluate `wp-config.php`.

0 commit comments

Comments
 (0)