-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli doesn't get env vars from wordpress image #594
Comments
I think it's probably worth adding a note somewhere, sure -- maybe something like "If you want to use the WP-CLI variants with an existing Or perhaps we should instead make it more clear that we do not modify |
I found this issue after finding my wp-cli based docker workflow is broken now. Thanks for linking to issues that helped you figure out how to fix it @jmmendivil I agree it would be nice if the documentation had an example of how to set up the environment to work with wp-cli. thanks for all the hard work! |
# temporarily pinned to the 5.5.3 release to work around docker-library/wordpress#594 FROM wordpress:5.6.2-php7.4-apache
I don't think it's the "right" solution, but wanted to note that as a temporary workaround to get my team workflow going for today I reverted to using image: wordpress:5.6.2-php7.4-apache that handles the wp-config.php the old way. My use case is basically to spin up a temporary docker container for local dev work using wp-cli/ssh to import the remote db and search/replace prod/dev URLs. The container is then destroyed after. My inclination is to use |
Does docker-library/docs#1911 help? Let me know how I can further improve the documentation. |
Thanks. After reading back the new doc and a handful of related linked issues it's still unclear to me if or how wp-cli is intended to work inside the wordpress container. I do have the envars configured in my docker-compose.yml, and they do correctly get passed to the container and do show when i run should wp-cli be picking up the defined envar values through wp-config.php when wp-cli is used? If it helps, i'll include a bit of output to show what's happening (with redacted password).
currently my workaround to fix wp-cli is running this via script inside the container.
I'm happy to learn, thanks for your patience and expertise! |
Perhaps messing around with I tried the following, and was successful (so I'm certain WP-CLI isn't stripping the variables before parsing the config file): bash-5.1$ env | grep -i wordpress_db
bash-5.1$ wp config list | grep DB_
DB_NAME wordpress constant
DB_USER example username constant
DB_PASSWORD example password constant
DB_HOST mysql constant
DB_CHARSET utf8 constant
DB_COLLATE constant
bash-5.1$ export WORDPRESS_DB_HOST='foo' WORDPRESS_DB_NAME='bar' WORDPRESS_DB_USER='baz' WORDPRESS_DB_PASSWORD='buzz'
bash-5.1$ wp config list | grep DB_
DB_NAME bar constant
DB_USER baz constant
DB_PASSWORD buzz constant
DB_HOST foo constant
DB_CHARSET utf8 constant
DB_COLLATE constant |
Thank you!!! you've helped me figure out my problem... I had previously wrapped wp-cli.phar in a script named wp so i could run as www-data user. Now I had to add --preserve-env for it to work correctly.
thanks so much for your patience in helping me sort out my mistake! |
Hey guys, great work here...
I wonder if we do need to update the CLI docs to include environment variables if it's used with docker-compose?
I had a composer file with wordpress and wordpress:cli that worked fine until the recent update (with
getenv_docker
). Thanks to #578 and #574 I was able to reconfigure it and make it work but maybe we should specify it somewhere in the docs for the others with the same problem (or maybe it is already written and I didn't find it).I can do a PR if necessary.
The text was updated successfully, but these errors were encountered: