Why want containers?
Distrobox and Toolbox containers allow to run a different distro ontop of your host.
This allows:
- testing
- isolating apps
- separating development environments,
- using outdated software or
- software only compatible with other distros
But, especially when using a different distro in the box than on your host OS, there is a big issue.
The mutable home directory
The home directory is completely unmanaged.
whereis fish
will not show your mutable (editable) config files, like in ~/.config/fish/
.
Also, there is a ton of apps not following the FDO spec and placing their files all over the place, often in home (like ~/.mozilla
).
Potential issues
By design, Toolbox and Distrobox containers use the same home directory as your user profile.
This breaks the fundamental idea of isolation, as doing random tests in the containers will not leave your home untouched.
The home directory is not cleaned by any package manager, so your dotfiles will grow and need to be manually deleted. Not nice.
Also as dnf system-upgrade
does not work within a Toolbox/Distrobox, you need to recreate the container with the then new version. If you dont do this all the time you upgrade your host, even if you use Fedora containers, you may have programs conflicting with their dotfiles.
This can cause breakage, that not even a system reset can fix.
Solution
Toolbox does not have a config to use a different home directory.
You can use Podman and assemble a container using a dockerfile, like in this example.
Using distrobox, this setting is not default (which hopefully changes soon), but you can solve this easily:
sudo tee -a /etc/distrobox/distrobox.conf <<EOF
DBX_CONTAINER_HOME_PREFIX=$HOME/distrobox
EOF
From now on, every newly created box will automatically use ~/distrobox/$boxname/
as home directory, without any extra arguments.
distrobox create boxname
distrobox enter boxname
cd ~
$PWD