I’m a beginner to container based development and I wanted to ask the approach to set up a distrobox container on one machine with some needed software installed, and then transfer that to another machine with the same software and environment. I’ve tried the following approach but it doesn’t seem to work.
Create a new Ubuntu based distrobox container on machine 1
Install some statistical software from downloaded debs (quarto, positron, conda, etc)
Use “podman commit” to create an image of this container on my localhost registry
Use “podman save” to save this image to an archive file
Transfer that to my newly set up machine 2
Use “podman load” to load that image onto my registry on machine 2
Use distrobox-create pointing to that image, while setting the environment variable to pull images to be false
The container seems to be successfully created, but then when I try to enter the container using distrobox enter, I get an error where the container seems to expect the username from machine 1 rather than machine 2
I’d appreciate any help in figuring out how to move these containers from one machine (or even one install to the next)! Thanks in advance!
In my experience, I think you just need to move your registry from your localhost to some other computer. If its a secondary computer you could just pull from the first, or in case of a new install you would either want a homelab type instance of a registry or use something like the GitHub registry.
You should also have a look at this repo, seems to be the images bluefin uses for its default distrobox creates. When I was working on a project similar I based it off of this which i think is just a bit easier to understand ‘wheres the ContainerFile’ You should install your default tools from more of a containerfile level rather then pulling,installing by hand, and exporting as tar.
I was also going to comment that I found distrobox really likes to pull images by default but I see you mention an ENV to stop that which I didn’t know existed! In anycase I found it much easier to just have it in a dedicated registry.
Thank you! As you say, I’ll first look into the container file approach (seems to happen through the distrobox-assemble command in this case), and if there are limits to how much of the env I can set up with that, I’ll look into pushing the image to the GitHub registry.
Yeah that is the best way, typically you don’t move or upgrade containers, you rebuild them from scratch. That’s how you keep your machines “synced”, the source of truth is the github repo for the container, not the container itself.
Aah good to understand, thank you! From what I can understand, the way to do this with distroboxes is using the .ini file with the distrobox-assemble command? And if so, something I’m running into is that any folders I create using the init_hooks have root as the owner, would there be a way to create folders under my own user? Alternatively, if .ini is the wrong approach, what would be the correct approach/equivalent of containerfile for distrobox containers? Apologies if these are basic questions and thank you!