-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Create custom HOME for containers #70
Comments
Update: we need to keep an eye also on A simple workaround could be that we enforce in |
Yes you might also need to keep eyes files like .bashrc, .bash_profile and .profile. The need to be autogenerated by the guest distros default mechanism and they need to persistent between sessions. For some reason podman might reset them if you use the approach used by tlbx. |
Yep I was working on this lightly now, and the only thing remaining is really this, having those default files ready. For now the adjustments needed are:
And it works as it is, we need to sort out the shell default files |
@yilkalargaw I've opened a pull request if you want to test it
and
This is still not having the default profile/bashrc file done |
I didn't know this project, neat 😄 Anyway it's been resetting because each start it does:
Which overwrites the files with the default ones in skel. The skel directory is not a ubiquitous default, so i'd say i would set like this in the if [ -d /etc/skel ]; then
for skel_file in /etc/skel/.*; do
if [ ! -f $HOME/$(basename $skel_file ]; then
cp $skel_file $HOME
fi
done
fi This should let initialize the home files only if a skel dir is present, and a dot file is not already present in the home |
Updated the PR with an implementation of the above 👍 EDIT: at a first glance, trying some major families (alpine, arch, ubuntu, fedora) seems to work as intended, and it persists |
Thanks @89luca89 that was fast. I tried it out on a fedora:35 and for some reason it is failing for me. I will list the commands I ran the the output from running the commands in verbose mode below mkdir /tmp/modmod
distrobox-create --image ubuntu:20.04 --name modmod --home /tmp/modmod/ # this part seems to work
distrobox-enter --name modmod # this fails with the following error
# Error: chdir: No such file or directory: OCI runtime attempted to invoke a command that was not found
#
# An error occurred The output of
|
Mhh seems it is a problem with That's a problem to solve, for now try EDIT: pushed a possible fix right now we're resolving the "have custom HOME problem" not the isolation problem, so we do not override the home mountpoint in case of custom home, we will add on top of that |
Thanks again @89luca89. You are right when I run it from /tmp it works. I'll try out the new commit and let you know. |
@89luca89 the new commit does exactly what you said. It opens in the current directory (weather I am in $HOME in the host or not) but litters in the given custom directory. Awesome. |
After some test this is working as intended, merging it and closing this, it will be available in next release 👍 |
Hello , i mean i created a Containerfile , which creates an image so i can use it with distrobox , but the config is not working when i use the -H to give my new created distrobox a new path for the Home dir does anyone know how to acheive this ? |
This is needed for #28
We should be able to use something like
--home-dir /path/i/like
so that a container can use a specific directory as HOME, instead of the $HOME of the host.This can be needed for various reasons, from isolation (as per #28) or to keep clean the host's HOME when we try software or build stuff.
Original HOME will anyway be reachable on /run/host/ so we will be still able to reach for files and such
The text was updated successfully, but these errors were encountered: