aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-05-30 15:15:57 +0200
committerPaul Holzinger <pholzing@redhat.com>2022-05-30 15:55:20 +0200
commit0e58636c3a599bb3d7d5ef06ab2773befe8a0150 (patch)
tree42435d07701510a6c7dd8bd4bbcbb5720f52b4ae /docs
parenta6f8cad545fa3242a2778c9a0d25da4da0a51ce2 (diff)
downloadpodman-0e58636c3a599bb3d7d5ef06ab2773befe8a0150.tar.gz
podman-0e58636c3a599bb3d7d5ef06ab2773befe8a0150.tar.bz2
podman-0e58636c3a599bb3d7d5ef06ab2773befe8a0150.zip
podman machine ssh: set correct exit code
Forward the ssh exit code to the podman caller. This is useful for scripts. Use the same logic as podman unshare. Fixes #14401 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/source/markdown/podman-machine-ssh.1.md30
1 files changed, 30 insertions, 0 deletions
diff --git a/docs/source/markdown/podman-machine-ssh.1.md b/docs/source/markdown/podman-machine-ssh.1.md
index db0350961..6a1455df1 100644
--- a/docs/source/markdown/podman-machine-ssh.1.md
+++ b/docs/source/markdown/podman-machine-ssh.1.md
@@ -14,6 +14,7 @@ first argument must be the virtual machine name. The optional command to
execute can then follow. If no command is provided, an interactive session
with the virtual machine is established.
+The exit code from ssh command will be forwarded to the podman machine ssh caller, see [Exit Codes](#Exit-Codes).
## OPTIONS
@@ -25,6 +26,35 @@ Print usage statement.
Username to use when SSH-ing into the VM.
+## Exit Codes
+
+The exit code from `podman machine ssh` gives information about why the command failed.
+When `podman machine ssh` commands exit with a non-zero code,
+the exit codes follow the `chroot` standard, see below:
+
+ **125** The error is with podman **_itself_**
+
+ $ podman machine ssh --foo; echo $?
+ Error: unknown flag: --foo
+ 125
+
+ **126** Executing a _contained command_ and the _command_ cannot be invoked
+
+ $ podman machine ssh /etc; echo $?
+ Error: fork/exec /etc: permission denied
+ 126
+
+ **127** Executing a _contained command_ and the _command_ cannot be found
+
+ $ podman machine ssh foo; echo $?
+ Error: fork/exec /usr/bin/bogus: no such file or directory
+ 127
+
+ **Exit code** _contained command_ exit code
+
+ $ podman machine ssh /bin/sh -c 'exit 3'; echo $?
+ 3
+
## EXAMPLES
To get an interactive session with the default virtual machine: