toolbox/doc/toolbox-run.1.md

109 lines
2.7 KiB
Markdown
Raw Normal View History

% toolbox-run 1
## NAME
toolbox\-run - Run a command in an existing toolbox container
## SYNOPSIS
**toolbox run** [*--container NAME* | *-c NAME*]
[*--distro DISTRO* | *-d DISTRO*]
[*--preserve-fds N*]
[*--release RELEASE* | *-r RELEASE*]
[*COMMAND*]
## DESCRIPTION
Runs a command inside an existing toolbox container. The container should have
been created using the `toolbox create` command.
On Fedora, the default container is known as `fedora-toolbox-N`, where N is
the release of the host. A specific container can be selected using the
`--container` option.
doc: Update to match current state & extend docs - Update "See also" sections Toolbox does not use Buildah for a considerable time now[0]. We can stop referencing it in the "See also" sections of the documentation. In some places mention podman command man pages where they are relevant. - Add section about toolbox images/containers Toolbox only supports certain OCI images. These should be documented. Also, document the change of fedora-toolbox image name. - Add a section about toolbox container setup Toolbox containers are specifically configured OCI containers. This should be documented so that users know what they're using. - Remove redundant part documentation The description of what `toolbox init-container` does is already in toolbox-init-container(1). There's no need to have it in toolbox-create(1). Instead, replace the text with a hint to visit the other part of documentation. - Clarify behaviour of --image option The fact that Toolbox by default tries to pull from the Fedora registry[1] should be noted. - Update synopsis & description of commands Mention options passed to `podman exec`. Remove redundant paragraph about container names (is already dealt with in toolbox-create(1)). There's no need to mention the name of the default container on Fedora since Toolbox now also supports RHEL. Mention the default used image on unrecognised systems. Emphasize the fact that toolboxes are not a fully sandboxed environment. Update the wording of the description and splits it into a few subsections. The description of the --monitor-host was inaccurate and while the option will go away in the future[2], it is currently in and should be more documented. [0] https://github.com/containers/toolbox/pull/160 [1] https://registry.fedoraproject.org [2] https://github.com/containers/toolbox/pull/617 https://github.com/containers/toolbox/pull/512
2021-03-04 19:36:22 +00:00
A toolbox container is an OCI container. Therefore, `toolbox run` is analogous
to a `podman start` followed by a `podman exec`.
## OPTIONS ##
The following options are understood:
**--container** NAME, **-c** NAME
2019-05-14 15:25:20 +00:00
Run command inside a toolbox container with the given NAME. This is useful
when there are multiple toolbox containers created from the same image, or
entirely customized containers created from custom-built images.
**--distro** DISTRO, **-d** DISTRO
Run command inside a toolbox container for a different operating system DISTRO
than the host. Has to be coupled with `--release` unless the selected DISTRO
matches the host system.
**--preserve-fds** N
Pass down to command N additional file descriptors (in addition to 0, 1,
2). The total number of file descriptors will be 3+N.
**--release** RELEASE, **-r** RELEASE
2019-05-14 15:25:20 +00:00
Run command inside a toolbox container for a different operating system
RELEASE than the host.
## EXIT STATUS
The exit code gives information about why the command within the container
failed to run or why it exited.
**1** There was an internal error in Toolbox
**125** There was an internal error in Podman
**126** The run command could not be invoked
```
$ toolbox run /etc; echo $?
/bin/sh: line 1: /etc: Is a directory
/bin/sh: line 1: exec: /etc: cannot execute: Is a directory
Error: failed to invoke command /etc in container fedora-toolbox-36
126
```
**127** The run command cannot be found or the working directory does not exist
```
$ toolbox run foo; echo $?
/bin/sh: line 1: exec: foo: not found
Error: command foo not found in container fedora-toolbox-36
127
```
**Exit code** The run command exit code
```
$ toolbox run false; echo $?
1
```
## EXAMPLES
### Run ls inside the default toolbox container matching the host OS
```
$ toolbox run ls -la
```
### Run emacs inside the default toolbox container for Fedora 36
```
$ toolbox run --distro fedora --release f36 emacs
```
### Run uptime inside a toolbox container with a custom name
```
$ toolbox run --container foo uptime
```
## SEE ALSO
`toolbox(1)`, `podman(1)`, `podman-exec(1)`, `podman-start(1)`