Is it possible to create a Toolbox with its own separate home directory?


I have been enjoying Fedora Silverblue for some time, but have not practiced much with Fedora Toolbox yet. I’ve been trying to use it a bit more for some development work and familiarize myself with it better.

I very much liked the idea of being able to create a temporary Toolbox container, to install random development packages, compile software, and then throw the whole thing away. A nice clean environment to avoid polluting my main system.

Unfortunately, this didn’t quite work out as I expected. While the Toolbox packages are separate from the host system, my home directory is not. The Toolbox shares the exact same home directory. This means that all the software I run inside the toolbox still pollutes my system by creating random messy files everywhere in my home directory.

I would like to keep a very clean environment, and avoid anything touching my stuff without permission. Is there any way to set it up so that a Toolbox container uses its own (temporary!) home directory, while still having access to my own files as normal? This would mean that software creating files automatically would use the Toolbox’s home directory, while I could manually choose to save files to my actual home directory.

Can this be done? Thanks in advance.

You can do this with an existing toolbox with something like:

$ toolbox run mkdir /home/foo
$ toolbox run env HOME=/home/foo bash

To set it up more permanently, you could add a file in /etc/profile.d inside the toolbox to override $HOME or other environment.


Thanks! Personally, I think it’d be great if it could be built into Toolbox, perhaps as an optional argument. This will work in the meantime though!

1 Like

I’ve sort of built something like this into my own toolboxes, by adding a couple of things to /etc/profile.d that among other things sources the .env file out of a project directory, e.g:

If I wanted to override HOME in one of my projects, I could just put it in the .env file. Right now I don’t do that by default, but I do override cd in one of those scripts, so that within the toolbox for a project, cd without arguments goes to the project directory, rather than $HOME.

1 Like