docs icon indicating copy to clipboard operation
docs copied to clipboard

Documentation's example is not working

Open andreibadescu opened this issue 1 year ago • 1 comments

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).

andreibadescu avatar Oct 24 '24 05:10 andreibadescu

https://docs.docker.com/reference/compose-file/interpolation/

Also found this where it says:

Image

The way this is being expressed is very confusing for me. I barely understand.

PLEASE also improve this section.

andreibadescu avatar Oct 24 '24 05:10 andreibadescu

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

aevesdocker avatar Nov 25 '24 11:11 aevesdocker

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

docker-robot[bot] avatar Dec 25 '24 03:12 docker-robot[bot]