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

non-slim Debian image does not clean up apt #222

Open
jaskij opened this issue Dec 6, 2024 · 2 comments
Open

non-slim Debian image does not clean up apt #222

jaskij opened this issue Dec 6, 2024 · 2 comments

Comments

@jaskij
Copy link

jaskij commented Dec 6, 2024

I just noticed that the non-slim image of Debian does not contain these two lines at the end, is this intentional?

apt-get remove -y --auto-remove \
        wget \
        ; \
    rm -rf /var/lib/apt/lists/*;
@Muscraft
Copy link
Member

Muscraft commented Dec 9, 2024

I was not around when this was originally added, but I believe this is added to the slim images to reduce their size as much as possible. As for why non-slim doesn't have it, I think it is because they are typically used as images to be built upon, and you want to keep apt's lists around. I checked node's slim template and it also had rm -rf /var/lib/apt/lists/* while their Debian template did not.

@jaskij
Copy link
Author

jaskij commented Dec 10, 2024

On the other hand Docker's own buildpack-deps does do the removal. It is also a standard practice for Debian-based images to run apt-get update before installing anything, which regenerates the cache.

I did a quick check - on a Bookworm system, the size of /var/lib/apt/lists/* is 82 MB, while regenerating the cache on my machine took under three seconds. This is with a 30 Mbps internet connection, running on a Ryzen 5 3600 with an NVMe.

On the other hand - this risks breaking images which do not run apt-get update.

Personally, I don't see why everyone cares about image sizes, since Docker has great deduplication, and wanted to just check in if this was intended since it seemed unusual.

If you do care about image size, I would suggest making this a breaking change to be deployed with Trixie (Debian 13, with ETA April 2025).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants