Skip to content

Fix outdated syntax rule about handling of quotes in Compose .env files - #14318

Closed
antoineco wants to merge 1 commit into
docker:mainfrom
antoineco:patch-1
Closed

Fix outdated syntax rule about handling of quotes in Compose .env files#14318
antoineco wants to merge 1 commit into
docker:mainfrom
antoineco:patch-1

Conversation

@antoineco

@antoinecoantoineco commented Feb 28, 2022

Copy link
Copy Markdown

Proposed changes

Since Compose 1.26.0, the following information doesn't seem to be true anymore:

  • There is no special handling of quotation marks. This means that they are part of the VAL.

Surrounding quotes (single or double) are effectively removed from the value, like in a shell.

Proof:

# .envMY_VAL='some_value'
# docker-compose.ymlversion: '3.7'services:
env-test:
image: alpineenvironment:
MY_VAL: ${MY_VAL:-}entrypoint:
- sleep
- '3600'init: true

With either Compose 1.29.2 or Compose 2.2.3:

$ docker-compose configservices: env-test: entrypoint: - sleep - '3600' environment: MY_VAL: some_value image: alpine init: trueversion: '3.7'

After executing docker-compose up with either Compose 1.29.2 or Compose 2.2.3:

$ docker-compose exec env-test printenv MY_VALsome_value

Related:

cc. @ulyssessouza, maybe you can validate my assumption that the docs are wrong since you worked on the aforementioned issue a while ago?

Unreleased project version (optional)

Related issues (optional)

Since Compose 1.26.0 (https://docs.docker.com/compose/release-notes/#1260),
this information doesn't seem to be true anymore. Surrounding quotes are
effectively removed from the value, like in a shell.
@netlify

netlifyBot commented Feb 28, 2022

Copy link
Copy Markdown

✔️ Deploy Preview for docsdocker ready!

🔨 Explore the source changes: 7e8bbd7

🔍 Inspect the deploy log: https://app.netlify.com/sites/docsdocker/deploys/621c9a394725390008e03b63

😎 Browse the preview: https://deploy-preview-14318--docsdocker.netlify.app

@usha-mandyausha-mandya added the area/compose Relates to docker-compose.yml spec or docker-compose binary label Mar 3, 2022
@usha-mandya

Copy link
Copy Markdown
Member

@ulyssessouza Could you PTAL?

@docker-robott

Copy link
Copy Markdown
Collaborator

Thanks for the pull request. We'd like to make our product docs better, but haven’t been able to review all the suggestions.
As our docs have also diverged, we do not have the bandwidth to review and rebase old pull requests.

If the updates are still relevant, review our contribution guidelines and rebase your pull request against the latest version of the docs, then mark it as fresh with a /remove-lifecycle stale comment.
If not, this pull request will be closed in 30 days. This helps our maintainers focus on the active pull requests.

Prevent pull requests from auto-closing with a /lifecycle frozen comment.

/lifecycle stale

@antoineco

Copy link
Copy Markdown
Author

/remove-lifecycle stale

@antoineco

Copy link
Copy Markdown
Author

Superseded by #15759

@antoineco
antoineco deleted the patch-1 branch January 23, 2023 07:39
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/composeRelates to docker-compose.yml spec or docker-compose binary

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@antoineco@usha-mandya@docker-robott