Here is an image of the toolbox
with a different /home
dir.
Here is me playing a YouTube video and the sound works. . .
Dockerfile to run Thorium Browser in a toolbox Container with a different /home :
# Use the Fedora 40 base image
FROM fedora:40
# Create a new user 'user' with a custom home directory and a unique UID
RUN useradd -m -d /home/$USER/Project/Podman_Containers/thorium/user -u 2000 user
# Set the new user's home directory
ENV HOME=/home/$USER/Project/Podman_Containers/thorium/user
# Install sudo and configure passwordless sudo for the user
RUN dnf -y install sudo && \
echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# Create necessary directories with correct permissions
RUN mkdir -p /home/$USER/Project/Podman_Containers/thorium/user/.config /home/$USER/Project/Podman_Containers/thorium/user/.local && \
chown -R user:user /home/$USER/Project/Podman_Containers/thorium/user
# Switch to the new user
USER user
# Set the working directory
WORKDIR /home/$USER/Project/Podman_Containers/thorium/user
# Copy Thorium browser RPM file into the container
COPY thorium-browser_124.0.6367.218_AVX2.rpm .
# Install Thorium browser from RPM
RUN sudo dnf -y install ./thorium-browser_124.0.6367.218_AVX2.rpm
# Optionally set entrypoint or default command if needed
# ENTRYPOINT ["thorium-browser"]
I got permission errors that were easily fixed :
mkdir: cannot create directory ‘/home/$USER/Project/Podman_Containers/thorium/user/.config’: Permission denied
touch: cannot touch '/home/$USER/Project/Podman_Containers/thorium/user/.config/toolbox/toolbox-welcome-shown': No such file or directory
by simply : sudo chown -R $USER:$USER /home/$USER/Project/Podman_Containers/thorium/user
So now Thorium’s image runs in a different home. This is a far less elegant solution than DistroBox but if you need to do stuff in toolbox, here ya’ go !