图源:LINO - 崩壊3rd繫体字版6周年 108386100
Toolbox can be seen as a wrapper for Podman, aiming to seamlessly integrate containers with the host operating system (Host OS). A similar tool to Toolbox is Distrobox. By sacrificing some container security features (such as port control, resource control, and file isolation), they achieve the following:
- User passthrough: Using the same user and home directory inside the container as the current Host user;
- Device passthrough: Directly accessing the Host’s
/dev
, /media
, etc.;
- Network passthrough: Directly using the Host network, providing a network experience identical to the host;
- Service passthrough: By directly utilizing the host’s
/run/user/<uid>
and /tmp
directories along with critical service sockets, it enables access to the host’s display services (X11/Wayland), network services (Avahi), D-Bus, and systemd journal from within the container.
Therefore, Toolbox can be used to:
- Serve as one of the software installation methods for immutable systems. For example, Fedora Silverblue and Fedora CoreOS come pre-installed with Toolbox, while other immutable systems may have Distrobox pre-installed;
- Utilize images from other distributions to seamlessly run programs designed for other distributions within the current one. For instance, running a GUI program that only provides Ubuntu deb packages on Fedora;
- Create a pseudo-root environment when lacking root privileges on the Host. For example, even non-privileged Toolbox containers can use
sudo dnf install
to install software;
- The image must have
sudo
package pre-installed, support the sudo
and wheel
groups to obtain root privileges, and enable the NOPASSWD
option;
- Use different versions of images to achieve “running old programs on new systems” or “running new programs on old systems”, or to conduct compatibility testing for programs;
- Customizing the image enables quick and consistent development environment setup;