Can I make use of other containers like debian or arch

I was wondering since this system doesn’t do LXC, I was wondering if there was a way to make use of Debian/Ubuntu/Arch containers?

Hello @kccallis
Welcome to the Fedora Discussion forum. I would suggest Fedora does use LXC as per https://fedoraproject.org/wiki/LXC

Thanks for the quick response… I was confused with the info that I read on using SB. For some reason, I thought with SB and toolbox, there was not an opportunity to make use of LXC because of podman.

Well, I haven’t personally tried it, having no interest in Unbuntu or Debian whatsoever. Podman uses cgroups V2 AFAIK. I have run different containers on SB than just toolbox though, and have had very little problems in that respect.

You can. Running

podman run --rm -it docker.io/library/debian

will get you a Debian container, and

 podman run --rm -it docker.io/library/archlinux

will get you an Arch Linux container, and so on.

Podman supports OCI images so anything from hub.docker.com or quay.io should work. For many distributions there are “official” images that are supported and usually also maintained by the upstream project.

4 Likes

In addition to running “docker” containers via podman, which can have other distros, you can even convince toolbox to use other distros too.

An awesome coworker of mine recently published a blog post where he details how he makes his own custom Silverblue-like desktop (with Sway instead of GNOME) — but also shares how he uses toolbox not just for Fedora development, but also Debian too:
https://piware.de/post/2020-12-13-ostree-sway/

Here’s the toolbox-specific part:

Also, I can now build and use toolboxes (i.e. “special” containers) for my Linux stuff in pretty much exactly the same way: build-devtoolbox for Fedora, and build-debian-toolbox for Debian or Ubuntu. I run these scripts once a week to rebuild the containers from scratch. When I want to do Fedora/cockpit development, I do toolbox enter -c devel (conveniently aliased to ts as in “toolbox shell”), and for Debian I can do toolbox enter -c sid.

[…]

Things like VMs or libvirt have worked well in standard containers for pretty much ever, but thanks to toolbox’es clever setup even graphical programs work just fine out of the box (for both Wayland and X.org). So whenever I want to try the latest GIMP, calibre, or need Geogebra or Google Chrome for a quick thing, they are just a dnf/apt/pip/tar install away, and don’t cause permanent clutter.

Note that in recent versions of toolbox, you can drop the -c when using enter (but not for all sub-commands), so if you use his Debian script (for example) or something quite like it, you can run toolbox enter sid afterward.

Also, if you copy the script and modify it to your liking, you can add (or remove) whatever packages you want installed. I do this, and whenever I install something I find I need, I add it to the script. This way, I can remove the container whenever I want and can do a fresh rebuild of it.

You can, of course, do upgrades inside the container too. That’s also fine. I usually just upgrade-in-place. But modifying the script means less work later on, when you do want to create a new container, or bump up the base version for a major release “upgrade”.

It also means you can copy the script to another computer and get a container exactly how you like it without extra work.


Edit: You can even use Martin’s Debian script for an Ubuntu container (without modifying it at all) like so:

./build-debian-toolbox 20.10 ubuntu

(Assuming you did a chmod +x build-debian-toolbox first, otherwise you’d need to do sh build-debian-toolbox 20.10 ubuntu.)
:grin:

Once you’re done with the script, to get back into the toolbox, just run:

toolbox enter 20.10

(It drops you into the toolbox by default on the first run. But it’s up to you to re-enter it later.)

You can even assign the toolbox enter command to a profile as your shell in GNOME Terminal (or other terminals) or alias it in your standard shell to something easier to remember. Or just hit ctrl-r in your shell to quickly find it again with a substring search.

As for Arch, openSUSE, or another distro — it’s likely easily possible, using Martin’s script as a starting point and make appropriate edits for where the distros are different (package installation, config files, etc.).

6 Likes

If you just want containers then docker/podman can get you any container distro thats out there.
LXC is slightly different container technology but you could potentially install it via rpm-ostree ( few tricky configurations have to be done to get it working with networking)

Toolbox as mentioned above works with other distros, there is a pull request on toolbox github which I’ve been using to get ubuntu working in toolbox without any issues so far.

1 Like

That is what I am interested in doing with podman. I would like to spin up debian and arch, preferable without having to add docker in the equation. So how does one do that?

There’s a post above which shows exactly what to do. The word “docker” appears just because it’s fetching those images from the Docker Hub, but you could replace with a different URL.

I’m going to go ahead and mark that post as the solution so it stands out. Let us know if you have further issues.

You can run toolbox ( podman with some integration so it doesn’t feel like container )
Or just podman.

Toolbox containers are essentially OCI containers with some tweaks to make it work for toolbox.

The official images for fedora are hosted here: toolbox/images/fedora at main · containers/toolbox · GitHub

Also there is a pull request to add Ubuntu to images proposed by Jmennius (Ievgen Popovych) · GitHub

You can build the images directly from his repository although you might expect some issues and it’s not officially supported by the project yet.

I’ve been using it for some ad-hoc stuff and haven’t really had many issues tho.

# Clone the Jmennius branch
git clone --single-branch --branch introduce-ubuntu-lts-images https://github.com/Jmennius/toolbox ubuntu-toolbox

#Build the image using podman (or dnf install podman-docker to use docker command with podman)
podman build -t toolbox-ubuntu:18.04 ubuntu-toolbox/images/ubuntu/18.04

# Create toolbox container from the built image
toolbox create --container my_ubuntu_18_04_01 --image toolbox-ubuntu:18.04

Created container: my_ubuntu_20_04_01
Enter with: toolbox enter my_ubuntu_20_04_01

Currently if you want any container images to work with podman they need to be tagged com.github.containers.toolbox:"true"

So if you already have some container image created just do :

podman tag my_image_id com.github.containers.toolbox:"true"
toolbox create --container my_container --image my_image_id

Also there are some tweaks inside container to make it integrate better, for that just look inside the official Fedora Dockerfiles etc.

3 Likes

Looks like there was an earlier discussion with no solution, just linking the two together: Toolbox into a different distro? - #6 by kxra

There is also Run Distrobox on Fedora Linux - Fedora Magazine which looks like an interesting project to do just this, surprised nobody mentioned it.

3 Likes