Toolbx doesn’t isolate anything. A Toolbx container runs as you, mounts your entire home directory and the host root, and reads ~/.aws/credentials as easily as your login shell does. That’s by design. Toolbx and Distrobox exist to make a container feel like the host, and even Distrobox’s --home flag, per its own docs, does not stop the host home from being mounted.
Encapsule, new in Fedora 45, takes the same toolbox images and inverts that default. The container gets your UID, one project directory and a home of its own, and nothing else crosses over until you name it. It is the box you want for running an AI coding agent, a curl | sh installer or an unfamiliar npm package. Everything below was run on a Fedora 45 VM with SELinux enforcing in December 2026, using Encapsule 0.6 from the updates repo with Toolbx and Distrobox installed next to it for comparison.
Encapsule shares nothing by default
Encapsule is a small Haskell CLI that builds a podman run command for you. It came into Fedora as a self-contained Fedora 45 Change owned by Jens Petersen, and its source and README live on GitHub. It grew out of the earlier toolbox-constrained project, and the idea is the same: keep the convenience of a toolbox image, drop the shared home. Its author is candid in the README that he now sandboxes tools with workcell, his Bubblewrap-based project, and keeps Encapsule as a flexible Toolbx replacement, which is the fair way to judge it here.
The --dryrun flag prints exactly what Encapsule hands to Podman, which is the quickest way to see what the container gets. This is the command behind a project environment created later in this guide, run from inside the project directory:
encapsule create fedora-toolbox:45 -p . --home ~/encap/webapp-home --sudo --dryrun
Trimmed to the flags that matter, this is what Podman receives.
podman "run" "-it" "--userns=keep-id" "--name" "encapsule-fedora-toolbox-45-webapp"
"--passwd-entry" "'kenneth:*:1000:1001::/home/kenneth:/bin/sh'" "--user=root"
"--workdir" "/home/kenneth/projects/webapp" "--security-opt" "label=level:s0"
"-v" "/etc/localtime:/etc/localtime:ro"
"-v" "/home/kenneth/encap/webapp-home:/home/kenneth:z"
"-v" "/home/kenneth/projects/webapp:/home/kenneth/projects/webapp:z"
"fedora-toolbox:45" "sh" "-c" "... exec runuser -u kenneth -- env HOME=/home/kenneth bash"
Podman applies it in this order.
--userns=keep-idkeeps your UID, so files you write are yours on the host- the container starts as root just long enough to write a sudoers drop-in (only with
--sudo), then copies/etc/skelas your user throughrunuser - two bind mounts: a separate home, and the project at its real path
runuserdrops to your user and starts bash in the project directory
Nothing else is mounted: there is no /run/host, no shared $HOME, no D-Bus or Wayland socket. Those come in only through capabilities, covered further down. Note the :z on both mounts too, because it changes SELinux labels on your host files, and that has a cost you’ll see later.
Install from updates, not the release repo
The package is in the main Fedora repos, so a plain dnf install is all it takes:
sudo dnf install -y encapsule
Then check which build landed and which capabilities ship with it. Both answers matter for the rest of this guide.
encapsule --version
encapsule list-caps
On the lab VM dnf picked the build from updates, and the bundled capability list printed eight entries.

The repo you pull from matters more than usual here. The frozen fedora repo carries the release-day 0.5.1 build, and that build gives the container user passwordless sudo on every run. The update moved sudo behind an explicit --sudo flag and added the pull subcommand. If encapsule pull answers with Invalid argument `pull', you are on the old build, and sudo dnf upgrade --refresh encapsule fixes both problems at once.
Two smaller details from rpm -ql and rpm -q --requires. The package installs a short alias, ncpsl, as a symlink to the same binary. Its dependencies also stop at shared libraries, so dnf won’t pull Podman in for you. Workstation already ships it; on a minimal install, follow the Podman setup guide for Fedora first.
Pull images by their full name
The Fedora toolbox image is the obvious first image, since Toolbx users already have it. Pull it by its short name, though, and the command fails.
encapsule pull fedora-toolbox:45
Podman’s short-name aliases cover fedora but not fedora-toolbox, and when there’s no terminal to ask which registry you meant, it refuses with Error: short-name resolution enforced but cannot prompt without a TTY. That hits scripts, CI jobs and anything run over plain ssh. With the registry spelled out, the pull finished in about 26 seconds on a cloud VM.
encapsule pull registry.fedoraproject.org/fedora-toolbox:45
Both attempts and the resulting image list are in one capture. The failed one exits with code 125 before any download starts.

Once the image is local, the short fedora-toolbox:45 name resolves without asking, which is why the rest of this guide uses it. The image is 1.14 GB, the same one Toolbx uses, so if you already run Toolbx there is nothing new to download.
A run container sees an empty home
The fastest way to see the difference is to point all three tools at the same secret. Install Toolbx and Distrobox next to Encapsule, then plant a fake credentials file and a tiny project to work in:
sudo dnf install -y toolbox distrobox
mkdir -p ~/.aws ~/projects/webapp
echo "aws_secret_access_key = EXAMPLEKEY" > ~/.aws/credentials
echo 'print("hello")' > ~/projects/webapp/app.py
Create one Toolbx container and one Distrobox container named dbx, both from the same toolbox image Encapsule uses. The -y and -Y flags skip the confirmation prompts.
toolbox create -y
distrobox create -n dbx -i registry.fedoraproject.org/fedora-toolbox:45 -Y
Now ask each tool to read the secret. encapsule run starts a throwaway container that is removed on exit.
encapsule run fedora-toolbox:45 -- bash -c 'id; ls -a $HOME; ls ~/.aws ~/.ssh; sudo -n true'
Then the same file through Toolbx and through a Distrobox container built from the identical image.
toolbox run cat ~/.aws/credentials
toolbox run sudo -n id -un
distrobox enter dbx -- cat ~/.aws/credentials
distrobox enter dbx -- sudo -n id -un
So does the same UID mean the same access? Not even close.

Inside Encapsule, three things are missing that the other two tools hand over:
- your real home and its dotfiles (only the three skel files exist)
~/.awsand~/.ssh- the host root under
/run/host
Toolbx printed the key straight away. Distrobox printed it too and answered sudo -n with root, so anything running in that box can also install packages and change the container behind your back. Toolbx refused sudo -n, but don’t read that as a lock: its toolbox-init-container man page says it grants the user sudo and root access, and the source gives the user an empty password, so plain sudo goes through without a prompt. If you came from the Distrobox and Toolbx setup on Fedora, that shared home is the part to unlearn.
Create keeps a project environment
A throwaway container is fine for one command. For real work you want installed tools to survive, which is what create does: it names the container after the image and the project directory, and mounts a home you choose. Make the home directory first, because Encapsule otherwise stops on a Press Enter to create it and continue prompt that hangs any non-interactive caller.
mkdir -p ~/encap/webapp-home
cd ~/projects/webapp
encapsule create fedora-toolbox:45 -p . --home ~/encap/webapp-home --sudo
You land in bash inside /home/kenneth/projects/webapp as your own user. The --sudo flag is a deliberate choice here: this box needs dnf, and its sudo reaches only the container. Leave it off for boxes that run code you trust less. From a second terminal, enter opens another shell in the same running container, which is how the tools were installed.
encapsule enter fedora-toolbox-45-webapp -- bash -c 'pwd; sudo -n id -un; sudo dnf install -y -q ripgrep nodejs-npm; rg --version | head -1; npm --version'
Next, do to the box what a typical vendor install script does to your dotfiles: append a PATH line to ~/.bashrc and create ~/.toolx/bin. Write notes.txt into the project as well. Run these in the container shell:
echo 'export PATH=$HOME/.toolx/bin:$PATH' >> ~/.bashrc
mkdir -p ~/.toolx/bin
echo ok > notes.txt
Back on the host, each change landed only where it should.

On the host, ~/.bashrc still ends at unset rc, there is no ~/.toolx, and neither rg nor npm exists. The export line sits in ~/encap/webapp-home/.bashrc, and notes.txt is in the real project because that is the one directory you shared. That split is the whole point: project files flow both ways, dotfile damage stays in the box. For toolchains you do want on the host, the Python, Node.js, Go and Rust setup for Fedora covers the native route.
Exiting create stops the container
Toolbx users trip over this one first. A Toolbx container keeps running in the background after you leave it. An Encapsule container lives exactly as long as the shell create opened. Type exit there and the container stops, even if a second terminal was still using it.
Error: “can only create exec sessions on running containers”
encapsule enter prints no running encapsule container found followed by this Podman error, exit code 255, when the create shell has ended. Running create again doesn’t help either, because it stops with encapsule: container encapsule-fedora-toolbox-45-webapp already exists. The container is still there, just stopped. Recovery goes in this order:
encapsule listshows the container asExitedpodman start -aistarts it and reattaches the shellencapsule enterworks again from other terminals
The Podman name carries an encapsule- prefix that Encapsule’s own commands leave off.
podman start -ai encapsule-fedora-toolbox-45-webapp
Here are the failures and the recovery in one capture, with proof that ripgrep and the .bashrc line survived the stop.

So keep one terminal as the owner of the container, and treat closing it as shutting the environment down.
Three flags tighten the box
By default the container still has a network and a writable project. When you’re running something you would rather not trust with either, three flags narrow it further:
--no-network: loopback only, no DNS-p .:O: the project as an overlay, so writes and deletes vanish on exit--readonly: the image filesystem becomes read-only, mounts stay writable
Each one was tested against the same webapp project, so run them from the host with the project as your working directory. Never run -p . from $HOME: the mount would hand over your whole home and relabel all of it for SELinux, ~/.ssh included.
cd ~/projects/webapp
encapsule run fedora-toolbox:45 --no-network -- bash -c 'ip -brief addr; curl -sS -m 5 https://fedoraproject.org -o /dev/null'
encapsule run fedora-toolbox:45 -p .:O -- bash -c 'rm app.py; echo scratch > build.log; ls'
ls ~/projects/webapp
encapsule run fedora-toolbox:45 --readonly -p . -- bash -c 'touch /usr/local/x; touch ok-in-project && echo project-writable; rm ok-in-project'
Each restriction held, and none of them needed a new image or a new container definition. They are plain flags on the run.

With --no-network only lo exists and curl fails with exit 6 on name resolution, while the default network returned HTTP 200 for the same URL. The overlay run deleted app.py and wrote build.log, yet the host project still holds app.py and notes.txt only. That makes :O a safe way to watch what an agent would change without keeping any of it. Under --readonly, /usr/local refused the write and the project accepted it.
Capabilities are the only way in
So how does a project get at ~/.aws when it really needs it? You grant it as a capability rather than mounting the whole home. A capability is a named TOML table of volumes, environment variables, PATH entries and security options. Encapsule looks for three files:
/usr/share/encapsule-0.6/data/config.toml, the bundled set/etc/xdg/encapsule/config.toml, system-wide (absent by default)~/.config/encapsule/config.toml, yours
They don’t stack evenly. Per the upstream README, any system file under /etc/xdg, even an empty one, replaces the bundled set entirely, while your user file augments whatever is in force. Because the bundled path carries the package version, it moves with each update, and the README’s /usr/share/encapsule/config.toml does not exist on Fedora. The bundled ssh and git capabilities mount ~/.ssh and ~/.gitconfig read-only. The wayland one is worth reading before you use it, because it sets label=disable and switches SELinux separation off for that container.
To give a project read-only AWS credentials and a default profile, open your user config.
mkdir -p ~/.config/encapsule
vim ~/.config/encapsule/config.toml
Add a table named after the capability.
[capabilities.aws-ro]
volumes = ["~/.aws:ro"]
env = ["AWS_PROFILE=dev"]
It shows up in encapsule list-caps straight away. The bundled git capability mounts ~/.gitconfig, so give git an identity on the host first if you never have:
git config --global user.name kenneth
git config --global user.email [email protected]
Then stack both capabilities and try to write to the credentials.
encapsule run fedora-toolbox:45 --cap aws-ro --cap git -- bash -c 'echo AWS_PROFILE=$AWS_PROFILE; cat ~/.aws/credentials; echo x >> ~/.aws/credentials; git config user.name; ls ~/.ssh'
The container gets exactly what the two tables list.

Now the profile variable is set, the key is readable, the append fails with Read-only file system, git knows your name, and ~/.ssh is still missing because nobody asked for it. A capability whose source is missing fails hard rather than silently: before ~/.gitconfig existed, --cap git stopped with encapsule: volume host path not found: /home/kenneth/.gitconfig.
Bind mounts relabel your files
Every user mount gets Podman’s :z option, which rewrites the SELinux label of the host path to container_file_t so the container may read it. After the runs above, ls -Z showed system_u:object_r:container_file_t:s0 on the project, the encapsule home and ~/.aws. For project directories that is harmless. For ~/.ssh it isn’t what you want, since that directory normally carries ssh_home_t, the type sshd expects on authorized_keys.
One encapsule run with --cap ssh was enough to relabel it. SSH logins still worked on the lab VM, but a plain restorecon won’t undo it, because container_file_t is one of the customizable types restorecon leaves alone unless you force it:
restorecon -RF ~/.ssh ~/.aws
This capture shows the relabel, the refused -Rv pass and the forced one.

Without -F every path reports not reset as customized by admin. With it, ~/.ssh goes back to ssh_home_t and ~/.aws to user_home_t. If a box needs to push to git over ssh, you have two better options than --cap ssh:
- an agent socket instead of key files: the bundled
ssh-agentcapability mounts$XDG_RUNTIME_DIR/ssh-agent.sock, though upstream’s newest release renames itssh-agent-experimental, so treat it as unfinished - a deploy key kept in that project’s encapsule home
Either way, your real ~/.ssh stays out of the container and keeps its label. That matters beyond this one box: while ~/.ssh carries container_file_t, SELinux no longer stops any other container you mount it into from reading the private keys. If you try --cap ssh on a remote machine anyway, keep a second SSH session open until you’ve confirmed logins still work.
Commit turns a toolbox into an image
If you already have a Toolbx container with your tools installed, you don’t have to rebuild it. encapsule commit snapshots a container into a local image named encapsule-<container>. To give the snapshot something to show, install jq into the Toolbx container created earlier as root, straight through Podman. Start it first in case it stopped since then:
podman start fedora-toolbox-45
podman exec --user root fedora-toolbox-45 dnf install -y -q jq
Then commit the container and run the new image.
encapsule commit fedora-toolbox-45
encapsule run fedora-toolbox-45 -- bash -c 'jq --version; ls ~/.aws'
Committing took about 3 seconds and produced localhost/encapsule-fedora-toolbox-45 at 1.25 GB. The run found jq-1.8.2 and still no ~/.aws: you keep the packages and lose the shared home, which is the migration most Toolbx users want.
Encapsule, Toolbx and Distrobox compared
All three run the same image on the same Podman, so the differences come down to the defaults each tool passes. Startup was timed five times each with /usr/bin/time.

Encapsule’s run costs about a second because it creates and removes a container every time. enter on a running container is closer to Toolbx. Distrobox’s enter came in at 0.49 to 0.51 seconds. The rest of the table comes from the captures earlier in this guide.
| Behaviour | Encapsule | Toolbx | Distrobox |
|---|---|---|---|
Host $HOME in container | No, separate home | Yes | Yes |
Read ~/.aws/credentials | Only with a capability | Yes | Yes |
sudo -n id -un by default | Refused (--sudo enables it) | Refused, yet plain sudo has an empty password | root |
| Host root mounted | No | Yes, /run/host | Yes, /run/host |
| Container after exit | Stops with the create shell | Keeps running | Keeps running |
| Network off switch | --no-network per run | No flag | --unshare-netns at create |
| Startup, one command | 0.99 to 1.03 s (run), 0.65 to 0.69 s (enter) | 0.52 to 0.55 s | 0.49 to 0.51 s |
Use Toolbx or Distrobox when the container is your daily shell and you want host integration. Use Encapsule when the code inside is the thing you don’t trust: an agent with shell access, a new dependency, a script from a blog post. The half second it costs is cheap next to a leaked key. The Fedora 45 release overview lists the other changes that landed alongside it, and the Fedora 44 to 45 upgrade gets an existing machine there.
Removing a box keeps your files
Encapsule’s own subcommands handle cleanup, container first and image last. Stop is only needed while a create shell is still open.
encapsule stop fedora-toolbox-45-webapp
encapsule rm fedora-toolbox-45-webapp
encapsule rmi fedora-toolbox-45
Removing the container deletes its root filesystem and the packages installed into it. The project directory and the encapsule home are plain host directories, so ~/projects/webapp and ~/encap/webapp-home both survived with their contents. Delete the home yourself when the project is done, and run restorecon -RF on any directory you shared that should go back to its normal label.
What crosses into the container, in order
Everything a process inside an Encapsule box can touch on the host arrives through one of these paths, and each one is opt-in apart from the first two.
| Order | Path in | How you grant it | Host effect |
|---|---|---|---|
| 1 | Your UID and username | Always, --userns=keep-id | Files written are owned by you |
| 2 | Network | Default on, --no-network removes it | Outbound internet and LAN, the path data leaves by |
| 3 | Project directory | -p DIR, or -p DIR:O for an overlay | Relabeled container_file_t; overlay writes are discarded |
| 4 | A home directory | --home DIR; without it, a fresh skeleton home | Relabeled; your real home is untouched |
| 5 | Root inside the container | --sudo or --root | Container only |
| 6 | Named host files and sockets | --cap NAME from the config files | Relabeled container_file_t, like ~/.ssh above |
| 7 | Anything else | -v, -e or --podman-opt | Whatever you pass to Podman |
Rows 2 to 7 are the ones to audit before you hand a box to an agent. If a file isn’t on your command line or in a capability you named, the container can’t see it. The network is the exception that stays open by default, and upstream’s README itself points to other tools for stronger network sandboxing, so give an untrusted agent --no-network unless it truly needs to fetch something.