Bug 1097344
| Summary: | Docker run exit code consistency | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Chris Evich <cevich> | |
| Component: | docker-latest | Assignee: | Lokesh Mandvekar <lsm5> | |
| Status: | CLOSED ERRATA | QA Contact: | atomic-bugs <atomic-bugs> | |
| Severity: | high | Docs Contact: | ||
| Priority: | medium | |||
| Version: | 7.0 | CC: | cevich, dwalsh, lsm5, lsu, santiago, sdodson, somalley | |
| Target Milestone: | rc | Keywords: | Extras | |
| Target Release: | --- | |||
| Hardware: | x86_64 | |||
| OS: | Linux | |||
| Whiteboard: | ||||
| Fixed In Version: | Doc Type: | Bug Fix | ||
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 1162807 (view as bug list) | Environment: | ||
| Last Closed: | 2016-05-12 14:52:52 UTC | Type: | Bug | |
| Regression: | --- | Mount Type: | --- | |
| Documentation: | --- | CRM: | ||
| Verified Versions: | Category: | --- | ||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
| Cloudforms Team: | --- | Target Upstream Version: | ||
| Embargoed: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 1303656 | |||
|
Description
Chris Evich
2014-05-13 15:17:50 UTC
Not sure what to do here. I would guess that you do not want the exit codes from within the container to return to $? docker run --rm fedora sh -c 'exit 2'; echo $? 2 But I think this is expected. (In reply to Daniel Walsh from comment #1) > Not sure what to do here. I would guess that you do not want the exit codes > from within the container to return to $? > > docker run --rm fedora sh -c 'exit 2'; echo $? > 2 > > But I think this is expected. See https://bugzilla.redhat.com/show_bug.cgi?id=1097334#c3 and https://bugzilla.redhat.com/show_bug.cgi?id=1097334#c4 chroot command has a close relationship to this
Exit status:
125 if 'chroot' itself fails
126 if COMMAND is found but cannot be invoked
127 if COMMAND cannot be found
the exit status of COMMAND otherwise
I have raised this issue with upstream https://github.com/dotcloud/docker/issues/6734 Great, I really like your idea of mirroring chroot's behavior, I think that's the right way to go. It also makes documentation easy, 'see also chroot's exit status' :D This will make testing efforts easier as well, since we can quickly/easily distinguish problems coming from docker or the container. Please comment on the issues Just to clarify: This bug is strictly for the run sub-command, since it needs special treatment. This issue is pretty important IMHO. Bug 1162807 is about non-run sub-commands, It's verified fixed in 1.4.1-25. Bug 1097334 is for all sub-commands not using consistent language in error/warning messages. Minor issue. shishir is this working in docker-1.6? *** Bug 1097334 has been marked as a duplicate of this bug. *** There is a pending PR for this, https://github.com/docker/docker/pull/14012. The PR has gotten positive response, waiting for merge. Fixed in docker-1.10/ Added note to https://trello.com/c/wK1SIihn for CI testing. Yes lets wait for docker-1.10 to say this is fixed. In docker-latest-1.10.3-19.el7.x86_64, there is a group of specified error code see https://github.com/docker/docker/pull/14012/files, Note:Use ``docker-latest`` instead of ``docker`` # docker-latest run this_image_does_not_exist /bin/false; echo $? Unable to find image 'this_image_does_not_exist:latest' locally Trying to pull repository docker.io/library/this_image_does_not_exist ... Pulling repository docker.io/library/this_image_does_not_exist Error: image library/this_image_does_not_exist not found docker: Error: image library/this_image_does_not_exist not found. See 'docker-latest run --help'. 125 # docker-latest run busybox /etc; echo $? exec: "/etc": permission denied docker: Error response from daemon: Container command could not be invoked.. 126 # docker-latest run busybox foo; echo $? exec: "foo": executable file not found in $PATH docker: Error response from daemon: Container command not found or does not exist.. 127 # docker-latest run busybox /bin/sh -c 'exit 3' # echo $? 3 FYI there is still some minor inconsistent behaviour: ref: bug 1331575 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHEA-2016-1057.html |