Skip to content
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

Mount only pwd for writing #389

Closed
abitrolly opened this issue Mar 15, 2020 · 8 comments
Closed

Mount only pwd for writing #389

abitrolly opened this issue Mar 15, 2020 · 8 comments
Labels
3. Enhancement Improvement to an existing feature

Comments

@abitrolly
Copy link

abitrolly commented Mar 15, 2020

I just found out that toolbox allows to modify files outside of directory where I invoked it. I expected it to maybe allow modification outside of pwd but at least discard them. Now I see that it doesn't protect my files outside of pwd from modifications.

Maybe there are some options that I missed?

UPDATE: This hack from #348 (comment) seems to work ok for now.

$ HOME=`pwd` toolbox create
$ HOME=`pwd` toolbox enter

It does create new files in project dir, but doesn't touch parents, which is good.

@HarryMichal HarryMichal added the 3. Enhancement Improvement to an existing feature label Mar 16, 2020
@njam
Copy link

njam commented Apr 4, 2020

I agree it would be nice if toolbox would allow not to mount the home directory, but only the "pwd" instead!

Programs installed in the toolbox will store many files in $HOME (eg $HOME/.cache, $HOME/.config etc), and those can be conflicting between different toolboxes, or between the host and a toolbox.

How about an option to use a home directory inside the container, and mount the current directory as for example $HOME/Workdir?

@abitrolly
Copy link
Author

It is kind of nice to be able to jump into toolbox and back without having to switch paths mentally, and having clean $HOME in toolbox by default.

@abitrolly
Copy link
Author

@njam on the second though I think that would be a good solution. At least a good option,

@njam
Copy link

njam commented May 3, 2020

I've experimented with this idea in a experimental toolbox implementation (source). I added a parameter to define which folder to mount:

$ toolbox-njam create foo --mount ~/Downloads

The ~/Downloads folder is mounted into the container and set as the working directory when using "enter". The mount path is stored on the container using a label, so it can be displayed in "list":

$ toolbox-njam list
NAME    IMAGE                                                      MOUNT
foo     registry.gitlab.com/njam/toolbox-njam/arch-toolbox:latest  /home/reto/Downloads

For basic use cases it works well. But I haven't extensively tested it. For example, what will/should happen if a folder outside of $HOME is mounted?

@markstos
Copy link

markstos commented May 4, 2020

tlbx fork has a -n option to not bind-mount the home directory.

@abitrolly
Copy link
Author

@markstos what bind-mount does in comparison with standard podman volumes?

@debarshiray
Copy link
Member

Duplicate of #183

@debarshiray debarshiray marked this as a duplicate of #183 May 13, 2020
@abitrolly
Copy link
Author

@debarshiray hey, the #183 is closed, but what is the solution?

@debarshiray debarshiray closed this as not planned Won't fix, can't repro, duplicate, stale Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. Enhancement Improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

5 participants