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

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

Closed
wants to merge 1 commit into from
Closed

Conversation

antoineco
Copy link

@antoineco antoineco commented Feb 28, 2022

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:

# .env
MY_VAL='some_value'
# docker-compose.yml
version: '3.7'

services:

  env-test:
    image: alpine
    environment:
      MY_VAL: ${MY_VAL:-}
    entrypoint:
      - sleep
      - '3600'
    init: true

With either Compose 1.29.2 or Compose 2.2.3:

$ docker-compose config
services:
  env-test:
    entrypoint:
    - sleep
    - '3600'
    environment:
      MY_VAL: some_value
    image: alpine
    init: true
version: '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_VAL
some_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
Copy link

netlify bot commented Feb 28, 2022

✔️ 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-mandya usha-mandya added the area/compose Relates to docker-compose.yml spec or docker-compose binary label Mar 3, 2022
@usha-mandya
Copy link
Member

@ulyssessouza Could you PTAL?

@docker-robott
Copy link
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
Author

/remove-lifecycle stale

@antoineco
Copy link
Author

Superseded by #15759

@antoineco antoineco closed this Jan 23, 2023
@antoineco antoineco deleted the patch-1 branch January 23, 2023 07:39
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

Successfully merging this pull request may close these issues.

3 participants