[go: up one dir, main page]

Skip to content
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

Documentation's example is not working #21225

Closed
1 task done
AndreiBadescu opened this issue Oct 24, 2024 · 2 comments
Closed
1 task done

Documentation's example is not working #21225

AndreiBadescu opened this issue Oct 24, 2024 · 2 comments
Labels
area/compose Relates to docker-compose.yml spec or docker-compose binary

Comments

@AndreiBadescu
Copy link

Is this a docs issue?

  • 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 AndreiBadescu added the status/triage Needs triage label Oct 24, 2024
@AndreiBadescu
Copy link
Author

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.

@aevesdocker aevesdocker added area/compose Relates to docker-compose.yml spec or docker-compose binary and removed status/triage Needs triage labels Oct 24, 2024
@aevesdocker
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/compose Relates to docker-compose.yml spec or docker-compose binary
Projects
None yet
Development

No branches or pull requests

2 participants