Documentation's example is not working
Is this a docs issue?
- [x] My issue is about the documentation content or website
Type of issue
Information is incorrect
Description
https://docs.docker.com/compose/how-tos/startup-order/
healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
This is not working, I think it should be with $$ (e.g. $${POSTGRES_USER}).
Am I right?
Location
https://docs.docker.com/compose/how-tos/startup-order/
Suggestion
Transform $ into $$
AND IMPROVE DOCS REGARDING ENVIRONMENT VARIABLES DURING HEALTHCHECK (Spent 2h debugging the issue and I'm still not sure how it works exactly).
https://docs.docker.com/reference/compose-file/interpolation/
Also found this where it says:
The way this is being expressed is very confusing for me. I barely understand.
PLEASE also improve this section.
Hi @AndreiBadescu, The documentation is correct, Compose's handling of $ ensures that valid variables like ${POSTGRES_USER} are either interpolated or passed as-is to the container runtime. You only need to use $$ if you want to include a literal $ in the string, not for normal variable interpolation. Using ${POSTGRES_USER} should work as expected, provided the variable is correctly defined in your environment or .env file. Have noted your request to improve the clarity of the docs and will get to this soon. Thanks
Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.
If you have found a problem that seems similar to this, please open a new issue.
/lifecycle locked