Skip to content
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

RFE: dnf install --container-build #2091

Open
xsuchy opened this issue Feb 26, 2025 · 1 comment
Open

RFE: dnf install --container-build #2091

xsuchy opened this issue Feb 26, 2025 · 1 comment
Labels
Priority: LOW RFE Request For Enhancement (as opposed to a bug) Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take

Comments

@xsuchy
Copy link
Member

xsuchy commented Feb 26, 2025

Most Dockerfiles has:

RUN dnf install package1 package2

But this leaves various unnecessary files in the image and the layers. Even

RUN dnf install package1
RUN dnf install package2

creates even more messy layers (unless the container image is squashed).

To produce small container images, users can do

RUN dnf install package1 package2 && dnf clean all && rm -rf /var/cache/yum

(you can read more about this at e.g., https://opensource.com/article/18/7/building-container-images )

But this construction is clumsy.

It would be nice (and likely easy to implement) to have option like --container-build so you can do:

RUN dnf install --container-build package1 package2

that will clean caches at the end of the transaction, knowing that this command is called in the build phase of the container, and we want to produce a minimal footprint on disk.

@ppisar
Copy link
Contributor

ppisar commented Feb 28, 2025

I don't understand whether you propose --container-build to erase all unessential files unconditionally, or only if DNF detects that it is running in a container.

I don't like a name of the option. This can be equally useful for updating virtual machine images.

It would be great to be more details on what unnecessary files to remove. You wrote caches. What about log files? Should that be also pruned? What about historical, rotated log files? What about DNF transaction history database?

We already had a similar request from people building containers, and never got a persuasive and deterministic use case, besides "we are lazy to write rm -rf /var/cache/* at the end of our Dockerfiles.

@m-blaha m-blaha added RFE Request For Enhancement (as opposed to a bug) Priority: LOW Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take labels Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: LOW RFE Request For Enhancement (as opposed to a bug) Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take
Projects
None yet
Development

No branches or pull requests

3 participants