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

docs: Correct run exit code 126 description #5591

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

noahsilas
Copy link
Contributor

The command to run inside the container is /etc. The semicolon is a statement terminator, which ends the command docker run busybox /etc, while echo $? prints the exit code of that full docker command.

Having this mistake could confuse someone who thinks that /etc; echo $? is all run inside the container, which wouldn't help the reader understand the exit code of the docker run command itself.

@noahsilas noahsilas requested review from thaJeztah and a team as code owners November 4, 2024 00:21
The command to run inside the container is `/etc`. The semicolon is a
statement terminator, which ends the command `docker run busybox /etc`,
while `echo $?` prints the exit code of that full docker command.

Having this mistake could confuse someone who thinks that `/etc; echo
$?` is all run inside the container, which wouldn't help the reader
understand the exit code of the `docker run` command itself.

Signed-off-by: Noah Silas <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented Nov 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.63%. Comparing base (2995631) to head (0c999fe).
Report is 47 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5591   +/-   ##
=======================================
  Coverage   59.63%   59.63%           
=======================================
  Files         346      346           
  Lines       29214    29214           
=======================================
  Hits        17421    17421           
  Misses      10824    10824           
  Partials      969      969           

@thaJeztah
Copy link
Member

Thank you!

We should probably consider (but not for this PR) writing them as separate steps, i.e., run a container, then check the exit-code

That said, it looks like with integration with runc and later containerd, the error-messages that's now returned for invalid commands have become rather verbose; each layer adding its own decoration, which means that there's now many details that may not be relevant to the user;

$ docker run --rm busybox /etc
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/etc": permission denied: unknown.

$ echo $?
126

$ docker run --rm busybox nosuchcommand
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "nosuchcommand": executable file not found in $PATH: unknown.

$ echo $?
127

$ docker run --rm busybox /nosuchcommand
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/nosuchcommand": stat /nosuchcommand: no such file or directory: unknown.

$ echo $?
127

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

let me bring this one in; I'll open a tracking ticket for the other bits

@thaJeztah thaJeztah merged commit b45477b into docker:master Nov 4, 2024
98 checks passed
@noahsilas
Copy link
Contributor Author

Thanks for the quick feedback and merge @thaJeztah! I appreciate the work you are doing here 😁

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

Successfully merging this pull request may close these issues.

3 participants