-
Notifications
You must be signed in to change notification settings - Fork 618
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
Support for toolbox containers #3107
Comments
The apptainer experience is very similar to this, main difference is that it uses a squashfs image and not a directory. But you remain as the same user, and you have access to your files and so on. Otherwise it calls it |
The "user" image looks something like this: (adding an entry to the system, with the user and group) https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user#_creating-a-nonroot-user |
Creating a user image: FROM ubuntu:latest
RUN userdel --remove ubuntu
RUN groupadd -g 1000 anders && useradd -u 1000 -g 1000 -d /home/anders.linux -s /bin/bash -m -N anders && rm -f /etc/.pwd.lock
WORKDIR /home/anders.linux
USER anders
CMD ["/bin/bash"] Running user container: $ nerdctl.lima run -it -u `id -u`:`id -g` -v $HOME:$HOME -w $HOME -e TERM anders-ubuntu-latest
anders@39ca671a1094:/home/anders$ Note: probably better to It should also feature an --init process, to care of the zombies. And have a --name, like any pet would. |
A "toolbox" would typically run as a privileged container, and use the host namespaces for network and pid. It would also mount the entire host filesystem (somewhere like |
Someone mentioned that there is also "distrobox", which is another system that is similar to toolbx...
Note: distrobox uses the GNU General Public License version 3, unlike toolbox which uses Apache License version 2 It is written in shell (/bin/sh), unlike toolbx which is using Go. There are lots of examples and different distributions. EDIT: It will need some love to work with
The problems are with the integrated Go templates, that work with docker and podman - but not (yet) with nerdctl |
For the lima handbook toolbx
$ lima toolbox enter
No Toolbx containers found. Create now? [y/N] y
Image required to create Toolbx container.
Download registry.fedoraproject.org/fedora-toolbox:41 ( ... MB)? [y/N]: y
Error: directory /home/anders not found in container fedora-toolbox-41
Using /home/anders.linux instead.
Welcome to the Toolbx; a container where you can install and run
all your tools.
- Use DNF in the usual manner to install command line tools.
- To create a new tools container, run 'toolbox create'.
For more information, see the documentation.
⬢ [anders@toolbx ~]$ distrobox
$ lima distrobox enter
Error response from daemon: No such container: my-distrobox
Create it now, out of image registry.fedoraproject.org/fedora-toolbox:39? [Y/n]:
Creating the container my-distrobox
39: Pulling from fedora-toolbox
40eb91ad8a1c: Pull complete
Digest: sha256:11f3634d4a8f2d4a69c4ad8442133f69979be49fa6269eccc6ab0863c39d59d0
Status: Downloaded newer image for registry.fedoraproject.org/fedora-toolbox:39
registry.fedoraproject.org/fedora-toolbox:39
Creating 'my-distrobox' using image registry.fedoraproject.org/fedora-toolbox:39 [ OK ]
Distrobox 'my-distrobox' successfully created.
To enter, run:
distrobox enter my-distrobox
uccessfully copied 2.56kB to /tmp/my-distrobox.os-release
Starting container... [ OK ]
Installing basic packages... [ OK ]
Setting up devpts mounts... [ OK ]
Setting up read-only mounts... [ OK ]
Setting up read-write mounts... [ OK ]
Setting up host's sockets integration... [ OK ]
Integrating host's themes, icons, fonts... [ OK ]
Setting up package manager exceptions... [ OK ]
Setting up rpm exceptions... [ OK ]
Setting up distrobox profile... [ OK ]
Setting up sudo... [ OK ]
Setting up user groups... [ OK ]
Setting up kerberos integration... [ OK ]
Setting up user's group list... [ OK ]
Adding user... [ OK ]
Setting up user home... [ OK ]
Ensuring user's access... [ OK ]
Container Setup Complete!
⚠️ First time user password setup ⚠️
Changing password for user anders.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
anders@lima-docker:/run/host/home/anders$ . /etc/profile.d/distrobox_profile.sh
📦[anders@my-distrobox anders]$ No lima changes need, for those to work. EDIT: Except for the prompt being broken. |
Description
I was looking into support for "toolbox containers", both the original root variants and the more recent rootless one:
https://github.com/coreos/toolbox/tree/0.0.9 (systemd)
https://github.com/coreos/toolbox (switched to podman)
https://github.com/flatcar/toolbox (went back to docker)
https://containertoolbx.org/ (rewritten, from Bash to Go)
Unfortunately the more recent
toolbox
requires podman, which in turn almost requires fedora (or get an old podman).There is support for Ubuntu distribution (and a
podman-toolbox
package), and there is support for Podman in Ubuntu.But it is not possible to use another container engine such as systemd or nerdctl, since this is not a goal of the project...
Anyway, the idea is that you use single VM (possibly read-only or spartan) - and then run all your work in containers.
The feature of the "toolbox" is that it preps the container for you, by selecting a common image and/or creating a user.
So that would make it more similar to WSL2, and the Hyper-V VM used: https://learn.microsoft.com/en-us/windows/wsl/
Where WSL actually does not add the user for you, just suggesting that you might want to look into adding one yourself.
Like so, example from Alma: https://wiki.almalinux.org/documentation/wsl.html (creating a system container)
Compared with: https://wiki.almalinux.org/cloud/Generic-cloud-on-local.html (creating an AlmaLinux VM/"lima")
So there could some integration with the "default" template and nerdctl, to access such a container running in Lima.
To start with, I made some small updates to the old
toolbox
(replaced rkt with crane) and it seems to run just fine...I think that colima started on some similar features called "layers", but that term is somewhat overloaded (overlayfs)
They are called "distros" in WSL, but that term is even worse. And there seems to be plenty of "toolbox" around as well.
But the goal would be to have some variant of
lima
, that would drop you in a container instead of on the machine.It is basically just running
nerdctl run -it
, the trick is setting up the parameters and the mounts - and the image.Toolbox: https://github.com/afbjorklund/systemd-toolbox
limactl start --containerd none
apt install systemd-container
install crane, install toolbox
limactl start --containerd system
Archive size:
56M fedora_latest.tar
(nerdctl save
format)55M fedora_latest.tar.gz
43M fedora_latest.tar.zst
With rootless and Lima it would look more similar to (but also needs some more setup):
limactl start
So the user, group and home directory needs adding. To the image, or the container at init.
The text was updated successfully, but these errors were encountered: