89luca89 / 89luca89/distrobox

[Suggestion] Hooks that run only during the creation of the container

Offen
#1,673 15 Kommentare 19 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Go
Sterne
13k
Forks
541
Ø Merge
20 Std. 47 Min.
Gemergte PRs (30 T.)
4

Beschreibung

**Is your feature request related to a problem? Please describe.**
Currently, there are three ways to modify a container image with distrobox: the `additional_packages` list, the `init_hooks` script, and the `pre_init_hooks` script. Each method fires when distrobox-init runs, which is to say, every single time a container is started, including when entering it after a period of inactivity with distrobox-enter. These hooks can potentially burn a lot of time and would seem to go against distrobox's philosophy of making distrobox-enter as performant as possible. The official distrobox-assemble documentation includes [examples](https://github.com/89luca89/distrobox/blob/main/docs/usage/distrobox-assemble.md#examples) that install Go, Deno, and Bun using the init hook, and these operations, again, fire during every container start.

**Describe the solution you'd like**
Perhaps there should be a `create_hooks` script that would run only when creating a container with distrobox-create. And distrobox should consider moving the "Installing basic packages" step out of distrobox-init and into this hook. Once a container has been created, I can't think of a good reason why the package list should be installed again. If any are missing, it would be because the user explicitly uninstalled them.

**Describe alternatives you've considered**
You could build custom images for distrobox using a Dockerfile, but that's a lot of ceremony for the kinds of customizations we apply to our distrobox containers. Hence why we have the additional packages list and the hooks in the first place.

You could clone an existing container to drop the defined hooks, while retaining your customizations, but that's not a very intuitive solution. It's only documented in a GitHub [discussion](https://github.com/89luca89/distrobox/issues/1091).

**Additional context**

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.