2021-11-12 16:44:13 +00:00
|
|
|
![README](data/gfx/README.gif)
|
2018-09-13 12:17:34 +00:00
|
|
|
|
2020-10-22 15:27:04 +00:00
|
|
|
[![Zuul](https://zuul-ci.org/gated.svg)](https://softwarefactory-project.io/zuul/t/local/builds?project=containers/toolbox)
|
2021-02-10 13:35:05 +00:00
|
|
|
[![Daily Pipeline](https://softwarefactory-project.io/zuul/api/tenant/local/badge?project=containers/toolbox&pipeline=periodic)](https://softwarefactory-project.io/zuul/t/local/builds?project=containers%2Ftoolbox&pipeline=periodic)
|
2020-10-22 15:27:04 +00:00
|
|
|
|
|
|
|
[![Arch Linux package](https://img.shields.io/archlinux/v/community/x86_64/toolbox)](https://www.archlinux.org/packages/community/x86_64/toolbox/)
|
|
|
|
[![Fedora package](https://img.shields.io/fedora/v/toolbox/rawhide)](https://src.fedoraproject.org/rpms/toolbox/)
|
|
|
|
|
2020-10-27 15:33:24 +00:00
|
|
|
[Toolbox](https://github.com/containers/toolbox) is a tool for Linux operating
|
|
|
|
systems, which allows the use of containerized command line environments. It is
|
|
|
|
built on top of [Podman](https://podman.io/) and other standard container
|
|
|
|
technologies from [OCI](https://opencontainers.org/).
|
2019-01-26 09:57:26 +00:00
|
|
|
|
|
|
|
This is particularly useful on
|
2019-10-14 10:49:29 +00:00
|
|
|
[OSTree](https://ostree.readthedocs.io/en/latest/) based operating systems like
|
2020-10-15 14:48:41 +00:00
|
|
|
[Fedora CoreOS](https://coreos.fedoraproject.org/) and
|
2021-01-25 20:42:39 +00:00
|
|
|
[Silverblue](https://silverblue.fedoraproject.org/). The intention of these
|
2019-01-26 09:57:26 +00:00
|
|
|
systems is to discourage installation of software on the host, and instead
|
2021-01-25 20:42:39 +00:00
|
|
|
install software as (or in) containers — they mostly don't even have package
|
|
|
|
managers like DNF or YUM. This makes it difficult to set up a development
|
|
|
|
environment or install tools for debugging in the usual way.
|
|
|
|
|
|
|
|
Toolbox solves this problem by providing a fully mutable container within
|
|
|
|
which one can install their favourite development and debugging tools, editors
|
|
|
|
and SDKs. For example, it's possible to do `yum install ansible` without
|
|
|
|
affecting the base operating system.
|
2019-01-26 09:57:26 +00:00
|
|
|
|
2021-01-25 20:42:39 +00:00
|
|
|
However, this tool doesn't *require* using an OSTree based system. It works
|
|
|
|
equally well on Fedora Workstation and Server, and that's a useful way to
|
|
|
|
incrementally adopt containerization.
|
2018-09-13 12:17:34 +00:00
|
|
|
|
2019-02-19 14:16:28 +00:00
|
|
|
The toolbox environment is based on an [OCI](https://www.opencontainers.org/)
|
2019-05-10 18:38:46 +00:00
|
|
|
image. On Fedora this is the `fedora-toolbox` image. This image is used to
|
|
|
|
create a toolbox container that seamlessly integrates with the rest of the
|
2021-01-25 20:42:39 +00:00
|
|
|
operating system by providing access to the user's home directory, the Wayland
|
2021-06-26 09:07:24 +00:00
|
|
|
and X11 sockets, networking (including Avahi), removable devices (like USB
|
|
|
|
sticks), systemd journal, SSH agent, D-Bus, ulimits, /dev and the udev
|
|
|
|
database, etc..
|
|
|
|
|
2018-08-31 16:02:49 +00:00
|
|
|
|
2021-01-25 19:19:48 +00:00
|
|
|
## Installation
|
|
|
|
|
|
|
|
Toolbox is installed by default on Fedora Silverblue. On other operating
|
|
|
|
systems it's just a matter of installing the `toolbox` package.
|
|
|
|
|
2018-08-31 16:02:49 +00:00
|
|
|
## Usage
|
|
|
|
|
2019-02-15 15:36:30 +00:00
|
|
|
### Create your toolbox container:
|
2020-10-27 15:45:27 +00:00
|
|
|
```console
|
2019-02-15 15:36:30 +00:00
|
|
|
[user@hostname ~]$ toolbox create
|
2020-10-22 16:12:25 +00:00
|
|
|
Created container: fedora-toolbox-33
|
2019-05-10 18:38:46 +00:00
|
|
|
Enter with: toolbox enter
|
2019-01-21 16:07:02 +00:00
|
|
|
[user@hostname ~]$
|
2018-08-31 16:02:49 +00:00
|
|
|
```
|
2019-05-10 18:38:46 +00:00
|
|
|
This will create a container called `fedora-toolbox-<version-id>`.
|
2018-08-31 16:02:49 +00:00
|
|
|
|
2019-02-15 15:36:30 +00:00
|
|
|
### Enter the toolbox:
|
2020-10-27 15:45:27 +00:00
|
|
|
```console
|
2019-02-15 15:36:30 +00:00
|
|
|
[user@hostname ~]$ toolbox enter
|
2019-05-16 12:46:21 +00:00
|
|
|
⬢[user@toolbox ~]$
|
2018-08-31 16:02:49 +00:00
|
|
|
```
|
2019-10-14 11:51:19 +00:00
|
|
|
|
2020-10-22 16:07:32 +00:00
|
|
|
### Remove a toolbox container:
|
2020-10-27 15:45:27 +00:00
|
|
|
```console
|
2020-10-22 16:12:25 +00:00
|
|
|
[user@hostname ~]$ toolbox rm fedora-toolbox-33
|
2020-10-22 16:07:32 +00:00
|
|
|
[user@hostname ~]$
|
|
|
|
```
|
|
|
|
|
2021-01-25 19:19:48 +00:00
|
|
|
## Dependencies and Building
|
2020-07-07 17:18:54 +00:00
|
|
|
|
|
|
|
Toolbox requires at least Podman 1.4.0 to work, and uses the Meson build
|
|
|
|
system.
|
|
|
|
|
|
|
|
The following dependencies are required to build it:
|
|
|
|
- meson
|
|
|
|
- go-md2man
|
|
|
|
- systemd
|
2020-12-30 15:32:06 +00:00
|
|
|
- go
|
|
|
|
- ninja
|
2021-11-03 04:51:33 +00:00
|
|
|
- patchelf
|
2020-07-07 17:18:54 +00:00
|
|
|
|
|
|
|
The following dependencies enable various optional features:
|
|
|
|
- bash-completion
|
|
|
|
|
|
|
|
It can be built and installed as any other typical Meson-based project:
|
2020-10-27 15:45:27 +00:00
|
|
|
```console
|
2020-07-07 17:18:54 +00:00
|
|
|
[user@hostname toolbox]$ meson -Dprofile_dir=/etc/profile.d builddir
|
|
|
|
[user@hostname toolbox]$ ninja -C builddir
|
2020-07-27 13:38:21 +00:00
|
|
|
[user@hostname toolbox]$ sudo ninja -C builddir install
|
2020-07-07 17:18:54 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Toolbox is written in Go. Consult the
|
2021-03-25 22:07:00 +00:00
|
|
|
[src/go.mod](https://github.com/containers/toolbox/blob/main/src/go.mod) file
|
2020-07-07 17:18:54 +00:00
|
|
|
for a full list of all the Go dependencies.
|
|
|
|
|
|
|
|
By default, Toolbox uses Go modules and all the required Go packages are
|
|
|
|
automatically downloaded as part of the build. There's no need to worry about
|
|
|
|
the Go dependencies, unless the build environment doesn't have network access
|
|
|
|
or any such peculiarities.
|
|
|
|
|
2019-10-14 11:51:19 +00:00
|
|
|
## Distro support
|
|
|
|
|
|
|
|
By default, Toolbox creates the container using an
|
|
|
|
[OCI](https://www.opencontainers.org/) image called
|
|
|
|
`<ID>-toolbox:<VERSION-ID>`, where `<ID>` and `<VERSION-ID>` are taken from the
|
2020-10-22 16:12:25 +00:00
|
|
|
host's `/usr/lib/os-release`. For example, the default image on a Fedora 33
|
|
|
|
host would be `fedora-toolbox:33`.
|
2019-10-14 11:51:19 +00:00
|
|
|
|
|
|
|
This default can be overridden by the `--image` option in `toolbox create`,
|
|
|
|
but operating system distributors should provide an adequately configured
|
|
|
|
default image to ensure a smooth user experience.
|
|
|
|
|
|
|
|
## Image requirements
|
|
|
|
|
2021-11-30 23:52:25 +00:00
|
|
|
Toolbox specifies the entry points of newly created containers in a certain
|
|
|
|
way. It's best if the OCI image doesn't specify any entry point of its own to
|
|
|
|
avoid interfering with the desired command line arguments. In other words,
|
|
|
|
there shouldn't be any `Entrypoint` in the `podman inspect` output for the
|
|
|
|
image. A wrong set of arguments will prevent `toolbox enter` from working.
|
|
|
|
|
|
|
|
If the image has a parent base image that does specify an entry point, then it
|
|
|
|
can be reset with this Containerfile snippet:
|
|
|
|
```Dockerfile
|
|
|
|
ENTRYPOINT []
|
|
|
|
```
|
|
|
|
|
2019-10-14 11:51:19 +00:00
|
|
|
Toolbox customizes newly created containers in a certain way. This requires
|
|
|
|
certain tools and paths to be present and have certain characteristics inside
|
|
|
|
the OCI image.
|
|
|
|
|
|
|
|
Tools:
|
2021-11-18 18:48:24 +00:00
|
|
|
* `capsh(1)`
|
2021-11-23 15:12:40 +00:00
|
|
|
* `mkdir(1)`
|
2021-11-23 14:51:20 +00:00
|
|
|
* `mount(8)`
|
2019-10-14 11:51:19 +00:00
|
|
|
* `passwd(1)`
|
|
|
|
* `test(1)`
|
|
|
|
* `touch(1)`
|
|
|
|
* `useradd(8)`
|
2020-08-30 14:26:07 +00:00
|
|
|
* `usermod(8)`
|
2019-10-14 11:51:19 +00:00
|
|
|
|
|
|
|
Paths:
|
|
|
|
* `/etc/host.conf`: optional, if present not a bind mount
|
|
|
|
* `/etc/hosts`: optional, if present not a bind mount
|
|
|
|
* `/etc/krb5.conf.d`: directory, not a bind mount
|
|
|
|
* `/etc/localtime`: optional, if present not a bind mount
|
2021-06-21 16:25:28 +00:00
|
|
|
* `/etc/machine-id`: optional, not a bind mount
|
2019-10-14 11:51:19 +00:00
|
|
|
* `/etc/resolv.conf`: optional, if present not a bind mount
|
|
|
|
* `/etc/timezone`: optional, if present not a bind mount
|
|
|
|
|
2020-08-21 15:41:28 +00:00
|
|
|
Toolbox enables `sudo(8)` access inside containers. The following is necessary
|
|
|
|
for that to work:
|
|
|
|
|
|
|
|
* The image should have `sudo(8)` enabled for users belonging to either the
|
|
|
|
`sudo` or `wheel` groups, and the group itself should exist. File an
|
|
|
|
[issue](https://github.com/containers/toolbox/issues/new) if you really need
|
|
|
|
support for a different group. However, it's preferable to keep this list as
|
|
|
|
short as possible.
|
|
|
|
|
|
|
|
* The image should allow empty passwords for `sudo(8)`. This can be achieved
|
|
|
|
by either adding the `nullok` option to the `PAM(8)` configuration, or by
|
|
|
|
add the `NOPASSWD` tag to the `sudoers(5)` configuration.
|
2019-10-14 11:51:19 +00:00
|
|
|
|
|
|
|
Since Toolbox only works with OCI images that fulfill certain requirements,
|
|
|
|
it will refuse images that aren't tagged with
|
|
|
|
`com.github.containers.toolbox="true"` and
|
|
|
|
`com.github.debarshiray.toolbox="true"` labels. These labels are meant to be
|
|
|
|
used by the maintainer of the image to indicate that they have read this
|
|
|
|
document and tested that the image works with Toolbox. You can use the
|
2021-11-30 23:53:12 +00:00
|
|
|
following snippet in a Containerfile for this:
|
2020-10-27 15:45:27 +00:00
|
|
|
```Dockerfile
|
2021-06-30 11:47:23 +00:00
|
|
|
LABEL com.github.containers.toolbox="true"
|
2019-10-14 11:51:19 +00:00
|
|
|
```
|
2021-06-30 11:47:23 +00:00
|
|
|
The label `com.github.debarshiray.toolbox="true"` was used in previous versions
|
|
|
|
of toolbox but is currently deprecated.
|