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

Healthcheck cli arguments CMD vs CMD-SHELL #28385

Closed
vdemeester opened this issue Nov 14, 2016 · 7 comments
Closed

Healthcheck cli arguments CMD vs CMD-SHELL #28385

vdemeester opened this issue Nov 14, 2016 · 7 comments

Comments

@vdemeester
Copy link
Member

vdemeester commented Nov 14, 2016

HEALTHCHECK supports CMD and CMD-SHELL as command to run. CMD-SHELL make docker prepend the healthcheck command with /bin/sh (hard-coded in the source code) — This makes it not work with some images that would not have a /bin/sh inside (like traefik or swarm or …).

This is ok, but any healthcheck cli flag (for run or service create/update) is only using CMD-SHELL. This makes it impossible to set a custom healthcheck for any image that do not provide a /bin/sh binary inside the image.

I think we should either do the other way around (i.e. using CMD by default on cli flags) or find a way to detect/specify if it should use CMD-SHELL or CMD.

Note that on docker build the use of CMD and CMD-SHELL is set depending on whether the HEALTHCHECK CMD is specified as a string or an array. We're also gonna do the same for compose (both here and in docker/compose)

/cc @thaJeztah @aanand @dnephin @talex5

@justincormack
Copy link
Contributor

It should use the SHELL setting that we already have to customise the shell, not hardcoded. Probably got missed when that was switched.

@thaJeztah
Copy link
Member

Do we have some way to set "SHELL none"? I think that's what's needed in this case (IIUC)

@talex5
Copy link
Contributor

talex5 commented Nov 14, 2016

What would the syntax be for specifying a command without using a shell? JSON on the command-line? docker run --health-cmd '["/myprog"; "--foo"]'? The quoting gets a bit exteme...

@justincormack
Copy link
Contributor

We don't allow specifying json on command line, yeah its not nice.

On 14 Nov 2016 11:44, "Thomas Leonard" notifications@github.com wrote:

What would the syntax be for specifying a command without using a shell?
JSON on the command-line? docker run --health-cmd '["/myprog"; "--foo"]'?
The quoting gets a bit exteme...


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#28385 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAdcPIzsL9jlsgz8Ov6YKFbVNBPNQXplks5q-Em1gaJpZM4KxNva
.

@vdemeester
Copy link
Member Author

@talex5 yeah that's the tricky part… I would tend to only use CMD via the command line (and let people use sh -c if they want the shell 👼).

@justincormack yep this is an orthogonal issue, but using the defined SHELL would be nice, I'll prepare a PR on that.

@vdemeester
Copy link
Member Author

#28438 for using the Container configured shell instead of hardcoded ones.

@wolverian
Copy link

This doesn't look solved yet - at least I don't see how to specify on the CLI to not use a shell at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants