2023-01-11 19:19:44 +00:00
|
|
|
% toolbox-run 1
|
2019-03-08 06:42:29 +00:00
|
|
|
|
|
|
|
## NAME
|
|
|
|
toolbox\-run - Run a command in an existing toolbox container
|
|
|
|
|
|
|
|
## SYNOPSIS
|
|
|
|
**toolbox run** [*--container NAME* | *-c NAME*]
|
2021-01-07 20:35:20 +00:00
|
|
|
[*--distro DISTRO* | *-d DISTRO*]
|
2022-06-16 21:35:15 +00:00
|
|
|
[*--preserve-fds N*]
|
2021-06-26 10:21:03 +00:00
|
|
|
[*--release RELEASE* | *-r RELEASE*]
|
|
|
|
[*COMMAND*]
|
2019-03-08 06:42:29 +00:00
|
|
|
|
|
|
|
## DESCRIPTION
|
|
|
|
|
|
|
|
Runs a command inside an existing toolbox container. The container should have
|
|
|
|
been created using the `toolbox create` command.
|
|
|
|
|
2021-06-26 01:34:41 +00:00
|
|
|
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.
|
2021-03-04 19:36:22 +00:00
|
|
|
|
2019-03-08 06:42:29 +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
|
2021-12-10 01:31:50 +00:00
|
|
|
when there are multiple toolbox containers created from the same image, or
|
|
|
|
entirely customized containers created from custom-built images.
|
2019-03-08 06:42:29 +00:00
|
|
|
|
2021-01-07 20:35:20 +00:00
|
|
|
**--distro** DISTRO, **-d** DISTRO
|
|
|
|
|
|
|
|
Run command inside a toolbox container for a different operating system DISTRO
|
2022-10-21 19:41:57 +00:00
|
|
|
than the host. Has to be coupled with `--release` unless the selected DISTRO
|
2021-12-17 14:24:20 +00:00
|
|
|
matches the host system.
|
2021-01-07 20:35:20 +00:00
|
|
|
|
2022-06-16 21:35:15 +00:00
|
|
|
**--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.
|
|
|
|
|
2019-03-08 06:42:29 +00:00
|
|
|
**--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.
|
2019-03-08 06:42:29 +00:00
|
|
|
|
2021-08-30 13:47:45 +00:00
|
|
|
## 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
|
2023-02-10 21:00:16 +00:00
|
|
|
Error: failed to invoke command /etc in container fedora-toolbox-36
|
2021-08-30 13:47:45 +00:00
|
|
|
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
|
2023-02-10 21:00:16 +00:00
|
|
|
Error: command foo not found in container fedora-toolbox-36
|
2021-08-30 13:47:45 +00:00
|
|
|
127
|
|
|
|
```
|
|
|
|
|
|
|
|
**Exit code** The run command exit code
|
|
|
|
|
|
|
|
```
|
|
|
|
$ toolbox run false; echo $?
|
|
|
|
1
|
|
|
|
```
|
|
|
|
|
2019-03-08 06:42:29 +00:00
|
|
|
## EXAMPLES
|
|
|
|
|
|
|
|
### Run ls inside a toolbox container using the default image matching the host OS
|
|
|
|
|
|
|
|
```
|
|
|
|
$ toolbox run ls -la
|
|
|
|
```
|
|
|
|
|
2021-12-10 02:02:54 +00:00
|
|
|
### Run emacs inside a toolbox container using the default image for Fedora 36
|
2019-03-08 06:42:29 +00:00
|
|
|
|
|
|
|
```
|
2021-12-10 02:02:54 +00:00
|
|
|
$ toolbox run --distro fedora --release f36 emacs
|
2019-03-08 06:42:29 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Run uptime inside a custom toolbox container using a custom image
|
|
|
|
|
|
|
|
```
|
|
|
|
$ toolbox run --container foo uptime
|
|
|
|
```
|
|
|
|
|
|
|
|
## SEE ALSO
|
|
|
|
|
2021-06-26 01:34:41 +00:00
|
|
|
`toolbox(1)`, `podman(1)`, `podman-exec(1)`, `podman-start(1)`
|