Stand-alone utility which is blend of `toolbox enter` and `podman container runlabel`

Does anybody know if there are any utilities which facilitate doing a podman exec very similarly to the Fedora Silverblue toolbox enter subcommand?

I have a cheap bash script I’ve named nest which is roughly equivalent to toolbox enter. Silverblue toolbox is impressive, I learned a lot looking at the code. But I find toolbox too controlling and monolithic. So I’m currently using a bunch of cheap highly custom bash scripts.

The ‘toolbox enter’ sub command functionality seems like something that can be decoupled into a simple stand-alone utility. Many separate methods can create mutable ‘pet’ containers. “Entering/execing” and “creating” these containers need not be with a single utility.

This utility would also be very similar to the ‘podman containter runlabel’ subcommand [1], except this utility would do podman exec rather than podman run. This utility assumes a container has already been created (podman create) with certain metadata label tags very similar to toolbox. Except more like ‘podman container runlabel’, details, like the actual podman parameters, are controlled in the container’s label, not fixed by the utility.

I hope such a utility can be like my nest script in that I can run commands like nest webdev to “enter” (like toolbox) a container with a name that is versioned (say container name “nest-webdeb-5”) and defaults to telling podman exec to run with the command /bin/bash --login. Or I could run nest chrome and it runs a container with the name say “nest-chrome-132” and by default tells podman exec to runs the command /usr/bin/google-chrome --no-sandbox.

Additional nice functionality is:

  • automatically podman start the container if not running
  • automatically podman stop the container when the last remaining podman exec process ends
  • subcommand nest ls which lists containers that nest can exec (enter)

[1] https://github.com/containers/libpod/blob/master/docs/source/markdown/podman-container-runlabel.1.md

1 Like

Interesting idea.

Can I ask why you don’t just upload your nest script to a git repo somewhere and see if there are people willing to help develop it?

Edit: Thinking about it more is it not easier just to alias your own commands to the toolbox equivalent? You can’t have that many containers for a use case like this?

Good idea to upload my scripts. I have done so and they can be found at https://github.com/castedo/cnest with description of their purpose and how to use them.

After some more thought, I thought maybe it’s not the best idea to have images setting the arguments to podman exec. From a security standpoint I can see it being a little worrisome what “–volume” arguments an image might set and then have podman exec use because the image requested it.

If you have any feedback or thoughts feel free to share. Thank you.