I have a distrobox where I want to add another volume.
I did not find how I can do that. Any help appreciated.
I have a distrobox where I want to add another volume.
I did not find how I can do that. Any help appreciated.
I am still interested if it is possible but found that it is not important because…
In the beginning I used DistroShelf to create a distrobox which is fine. But I found that it is better to create a script to create it via distrobox-create
Then things are easily reproducible. Very satisfying…
@locke496 Have you looked at the distrobox assemble
sub command? I believe it may help here depending on what you are attempting to accomplish.
TL;DR but the underlying technology does not provide a way to add a volume to an existing container. To do something like that you would need to utilizing standard Linux mechanisms inside of the running container instead.
However, it is strongly encouraged to add the necessary automation to attach the volume during the distrobox assemble (or creation) process instead.
distrobox is a set of tools that wrap many docker / podman concepts and add some value add features (such as declaring volumes to be mounted when assembling a distrobox). Similarly, Distroshelf is a wrapper around the distrobox toolkit.
Remember that a running distrobox is just an OCI container. The term volume
is somewhat overloaded - although the concepts are related.
docker volume
allows volumes to be defined and managed by docker for the purpose of declaring storage that can be used (even shared) via a logical name across containers in the docker systemVOLUME
keyword - the result is a placeholder through which storage may be mounted - these are established when the image (not container) is builtVOLUME
placeholder is not provided by the base image in use, the docker / podman systems provide for mounting an arbitrary storage location. The–-volume
option to the docker run
sub command may be used to assign mount details which may (but is not required) to use a system-declared named volume
.The term docker as used in the statements above may be replaced with podman as they are mostly compatible with regards to the features being discussed.
When using distrobox assemble
you may specify volume=
entries (in a distrobox.ini file) specifying additional volumes to mount when the container is started (typically via the distrobox enter
sub command). Using distrobox.ini
enables many other features that would otherwise need to be specified on a distrobox create
command line.
I purposely provided a general explanation to encourage you to read the docs for the items of interest.
Enjoy your distrobox journey. It is an amazingly rich set of tools.
@klmcw Thank you very much. This is very interesting.
For the beginning I will deal with distrobox-create
for creating and cloning as I need some stuff working now. But then I will probably switch to distrobox-assemble
as it makes things presumably much more flexible.
For the time being my concept is simple:
${DISTRO}base
container which has some additional packages I need anyway. Example: distrobox archbase
archbase
and add what I need for this new distrobox@locke496 FYI - after the experimentation I did as I was diving deep into usage of bluefin-dx
I created the tool linked below for myself. My use cases were probably much different than yours, but I believe the guiding principles I developed to be portable across any potential usage of distrobox.
Enjoy!
Great, I will take a deeper look at what you did…
I skimmed the distrobox.ini
and I was wondering about nvidia=true
. I should mention that my laptop has nvidia and nvidia is active here.
But when is it recommended to set it to true in a container?
@locke496 only when you need it. I use CUDA for math compute loads.
Try it. And then enter the distrobox and do a mount
command to see part of what it does. Pretty amazing feature; but it can be a lot of extra stuff if not needed. Since I end up with only a single distrobox that is <3GB and usually at most a single devcontainer based on the same image - I live with it.
Your use cases may drive you to be more conservative - and only enable nvidia=true
where you need it. FYI
Yeah, it seems only be useful if I have a distrobox where I run stuff which utilizes the GPU.
I had already set nvidia
to false for my distroboxes.