-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
`docker exec $CID false' does not set exit value to 1 #8703
Comments
I found why the exit code is not 1: to do this you would have to reengineer the Alternatives? An option to export the exit code to an environment variable (on host)? I am sorry but as it is it's not much usable (without other hacks) and I actually will keep using nsenter |
@SvenDowideit thanks for cross-linking it :) It will take a bit of efforts to create a pull request, as first it's needed to refactor how the engine handles results. I am not writing one at the moment, both because I can use nsenter and because I was waiting for more Docker developers feedback. |
We have similar code for |
+1 |
@mkoval I use that as an SSH-like drop-in replacement, and I better customized the shell environment second my needs |
+1 |
Closes moby#8703 Also made it so that when "docker exec" is run with -d (detached mode) it'll print the id of the exec to the screen like "docker run -d" does so people can query it via: curl http://.../exec/{id}/json Signed-off-by: Doug Davis <dug@us.ibm.com>
Closes moby#8703 Also made it so that when "docker exec" is run with -d (detached mode) it'll print the id of the exec to the screen like "docker run -d" does so people can query it via: curl http://.../exec/{id}/json Signed-off-by: Doug Davis <dug@us.ibm.com>
Note - only support the non-detached mode of exec right now. Another PR will add -d support. Closes moby#8703 Signed-off-by: Doug Davis <dug@us.ibm.com>
Note - only support the non-detached mode of exec right now. Another PR will add -d support. Closes moby#8703 Signed-off-by: Doug Davis <dug@us.ibm.com>
Closes moby#8703 Also made it so that when "docker exec" is run with -d (detached mode) it'll print the id of the exec to the screen like "docker run -d" does so people can query it via: curl http://.../exec/{id}/json Signed-off-by: Doug Davis <dug@us.ibm.com>
Is this exec return code always 0 works now? |
I am experiencing a weird issue with 1.3: exit value is always 0, regardless of command executed.
For example, running this script:
The output is:
To verify that this problem is Docker-only, make same test with ssh or nsenter (my fork), that correctly return exit value 1.
I am right now looking up the code, as I have some clues about what could be happening, and will report later.
Update: I am using native driver. The log correctly reports the exit status:
Update 2: I realize this is more a feature request rather than a bug: the "exec" operation is successful, but I believe users expect docker cli to fail with same exit code as container's process
The text was updated successfully, but these errors were encountered: