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

ENGDOCS-2382 #21848

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

ENGDOCS-2382 #21848

wants to merge 4 commits into from

Conversation

aevesdocker
Copy link
Contributor

@aevesdocker aevesdocker commented Jan 17, 2025

Description

Adds info in compose-spec/compose-spec#557

Related issues or tickets

Reviews

  • Technical review
  • Editorial review
  • Product review

@github-actions github-actions bot added the area/compose Relates to docker-compose.yml spec or docker-compose binary label Jan 17, 2025
Copy link

netlify bot commented Jan 17, 2025

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit b10d1fb
🔍 Latest deploy log https://app.netlify.com/sites/docsdocker/deploys/678a7d9c30213200099fc348
😎 Deploy Preview https://deploy-preview-21848--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@aevesdocker aevesdocker marked this pull request as ready for review January 17, 2025 16:06
@aevesdocker aevesdocker requested a review from a team January 17, 2025 16:06
Copy link
Contributor

@polarathene polarathene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not familiar with the difference of this document file vs the related PR but you may want to ensure they're in sync? The content is diverging here (and also incorrect in advice).

Comment on lines +272 to +276
> If the `entrypoint` (or the image's `ENTRYPOINT`) is configured to invoke a shell, use the exec form syntax for `command` to ensure proper processing. For example:
>
> ```yaml
> command: [ "bundle", "exec", "thin", "-p", "3000" ]
> ```
Copy link
Contributor

@polarathene polarathene Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be incorrect.

If the image/container has ENTRYPOINT ["/bin/sh", "-c"] set, then command should be a string value for providing to -c, thus you would need:

# Compose will also treat entrypoint config like below as if it were `ENTRYPOINT ["/bin/sh", "-c"]`:
entrypoint: /bin/sh -c
command: ["bundle exec thin -p 3000"]
# or
command: "'bundle exec thin -p 3000'"
# or
command: |
  'bundle exec thin -p 3000'

When the image has no entrypoint to run, the equivalent command only form of this is:

command: /bin/sh -c 'bundle exec thin -p 3000'
# or
command: ["/bin/sh", "-c", "bundle exec thin -p 3000"]
# or (because no shell environment is actually needed), either of these:
command: bundle exec thin -p 3000
command: [ "bundle", "exec", "thin", "-p", "3000" ]

The exec-form / YAML list style is less ambiguous with how Compose will segment the value into exec-form, it technically doesn't have shell-form (only really exists for Dockerfile).


As you can see above, it would be good for the documentation to communicate this (or the value in preferring YAML list style which is clearer in how it'll be handled).

It took a while for me to experiment and grok what was going on: docker/compose#12403 (comment) thus it'd be good if other users could avoid repeating that with the docs providing clear guidance/insight.

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.

2 participants