Toolbx

As an immutable host, Fedora Silverblue is an excellent platform for container-based development and, for working with containers, buildah and podman are recommended.

Fedora Silverblue also comes with the toolbx utility, which uses containers to provide an environment where development tools and libraries can be installed and used.

Why use toolbx?

Toolbx makes it easy to use a containerized environment for everyday software development and debugging. On immutable operating systems, like Fedora Silverblue, it provides a familiar package-based environment in which tools and libraries can be installed and used. However, toolbx can also be used on package-based systems.

Using Toolbx for running your workflows in a containerized manner brings you several advantages:

  • Ele mantém o sistema operacional hospedeiro limpo e estável e ajuda a evitar a confusão que pode acontecer após a instalação de muitas ferramentas de desenvolvimento e pacotes.

  • Você obtém acesso a diferentes versões de distribuições com suporte, independentemente da versão em execução.

  • Os contêineres são uma boa maneira de isolar e organizar as dependências necessárias para diferentes projetos.

  • Os contêineres são um espaço seguro para experimentar: se algo der errado, é fácil jogar uma toolbox fora e começar de novo.

However, it is very important to note that toolbx containers are still integrated with your host system, so you should not attempt to do things or run software you otherwise wouldn’t on your host system. Toolbx containers are not completely isolated environments like virtual machines.

Como funciona

Toolbx takes the work out of using containers, by providing a small number of simple commands to create, enter, list and remove containers. It also integrates toolbx containers into your regular working environment, to make it easy for you to use them as an everyday development space.

Containers are created from images and those are usually a very stripped down version of distributions. In such images there are almost no tools and documentation available. The team behind Toolbx maintains a Fedora image where such tools and documentation are available, providing a good out of the box experience.

Each toolbx container is an environment that you can enter from the command line. Inside each one, you will find:

  • Seu nome de usuário e permissões existentes

  • Acesso para seu diretório pessoal (home) e várias outros locais

  • Acesso ao sistema e à sessão D-Bus, journal do sistema e Kerberos

  • Ferramentas de linha de comando comuns, incluindo um gerenciador de pacotes (por exemplo, DNF no Fedora)

In other words, toolbx containers look, feel and behave like a standard Linux command line environment. By connecting all this information, toolbx containers lose a certain amount of security gained by using the containers technology. Therefore, you should not treat toolbx containers as a sandbox where you can execute any script you would never run on any other system.

In most cases, when a command is run inside a container, the program from inside the container is used. However, there are a few special cases where the program on the host is used instead (using flatpak-spawn). One example of this is the toolbox command itself; this makes it possible to use toolbx from inside toolbx containers.

Instalação

Fedora Silverblue

Toolbx is preinstalled on Fedora Silverblue.

Fedora Workstation

Toolbx can be installed on Fedora Workstation (or any package-based version of Fedora) with the following command:

$ sudo dnf install toolbox

Sua primeira toolbox

Once toolbx is installed, two simple commands are required to get started:

$ toolbox create

This will download an OCI image and create a toolbx container from it. Once this is complete, run:

$ toolbox enter

Uma vez dentro da toolbox, você pode acessar ferramentas de linha de comando comuns e instalar novas usando um gerenciador de pacotes (por exemplo, DNF no Fedora).

When the prompt is inside a toolbox, it is prepended with a diamond: this indicates that the prompt is inside a toolbx container. The diamond symbol may not be present if you use a custom shell theme.

Comandos e uso

toolbox create [opções] <nome>

Creates a toolbx container. This will download an OCI image if one isn’t available (this is required to create the container). By default an image matching the version of the host is used. If the host system does not have a matching image, a Fedora image is used instead.

Used without options, toolbox create will automatically name the container it creates. To create additional toolboxes, use the <name> argument.

Para usar uma versão específica do sistema host (por exemplo, Fedora 32 no Fedora 34), use a opção --release <lançamento> | -r <lançamento>.

To use a different distribution to create a toolbx container (e.g., RHEL on Fedora), use the --distro <distro> | -d <distro> option.

Para usar uma imagem diferente, use a opção --image <nome> | -i <nome>.

toolbox enter [opções] <nome>

Enters a toolbox for interactive use. Used without options, toolbox enter opens the default toolbox.

Para inserir uma toolbox com um nome específico, use o argumento nome.

Para inserir uma toolbox para uma distribuição diferente (por exemplo, Fedora no RHEL), use a opção --distro <distro> | -d <distro>.

Para entrar em uma toolbox com uma versão específica (por exemplo, RHEL 8.1 no RHEL 8.3), use o método `--release <lançamento> | opção -r <lançamento> `.

toolbox run [opções] <cmd> <arg …​>

Runs a command in a toolbox without entering it. Used without options, toolbox run runs the command in the default toolbox.

Para executar um comando em uma toolbox com um nome específico, use o método `--container <nome> | opção -c <nome> `.

Para executar um comando em uma toolbox para uma distribuição diferente (por exemplo, Fedora no RHEL), use a opção --distro <distro> | -d <distro>.

Para executar um comando em uma toolbox com versão específica (por exemplo, RHEL 8.1 no RHEL 8.3), use a opção `--release <lançamento> | -r <lançamento> `.

toolbox list [opções]

Lists local toolbx images and containers.

Para mostrar apenas contêineres, use o método --containers | -c.

Para mostrar apenas imagens, use a opção --images | -i.

toolbox rm [opções] <nome …​>

Removes one or more toolbx containers.

A opção --force | -f remove os contêineres marcados mesmo se estiver em execução.

The --all | -a option removes all toolbx containers.

toolbox rmi [opções] <nome …​>

Removes one or more toolbx images.

A opção --force | -f remove as imagens marcadas e todos os contêineres que foram criados usando as imagens marcadas.

The --all | -a option removes all toolbx images.

toolbox --help

Shows Toolbx’s manual page.

Saindo de uma toolbox

Para retornar ao ambiente host, execute exit ou saia do shell atual (normalmente Ctrl+D).

Debaixo do capô

Toolbx uses the following technologies:

Contato e problemas

To report issues, make suggestions, or contribute fixes, see toolbx’s GitHub project.

To get in touch with toolbx users and developers, use Fedora’s Discourse instance, or join the #silverblue IRC channel on Libera.