Toolbox is an unprivileged development environment which ships with Fedora Silverblue. It uses Podman under the hood to create containerised environments that are (almost) seemlessly integrated with the host system.

In this post, we will use map Toolbox-installed programs from the container to your host.

toolbox-run-in-container.sh

Save this snippet in $HOME/bin:

#!/bin/bash

PROGRAM="$(basename $0)"
CONTAINER="$(readlink $0 | sed 's/toolbox-//')"
toolbox run -c "$CONTAINER" "$PROGRAM" $*

How to

  1. Create a Toolbox container, let's call it example
toolbox create -c example
  1. Enter in and install a program of choice
toolbox enter -c example
sudo dnf install golang
  1. In $HOME/bin, create a symlink of the snippet, referring to the toolbox container name
ln -s toolbox-run-in-container.sh toolbox-example
  1. Also in $HOME/bin, create a symlink of the program to run inside of the container
ln -s toolbox-example go

Usage

Now that the symlinks are set up, the program(s) can be used.

go version
go version go1.16 linux/amd64