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

Delete the apt-get lists after installing something DOK-DL3009 #270

Open
philipjonsen opened this issue Mar 24, 2022 · 0 comments
Open

Delete the apt-get lists after installing something DOK-DL3009 #270

philipjonsen opened this issue Mar 24, 2022 · 0 comments

Comments

@philipjonsen
Copy link

DESCRIPTION
Cleaning up the apt cache and removing /var/lib/apt/lists helps keep the image size down. Since the RUN statement starts with apt-get update, the package cache will always be refreshed prior to apt-get install. You can read more about it here: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/

Note: Clean up must be performed in the same RUN step, otherwise it will not affect image size.

Problematic code:

RUN apt-get update && apt-get install -y python

Correct code:

RUN apt-get update && apt-get install -y python
&& apt-get clean
&& rm -rf /var/lib/apt/lists/*

bug5

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

1 participant