-
Notifications
You must be signed in to change notification settings - Fork 424
DL3009
londondaintta edited this page Dec 13, 2023
·
8 revisions
RUN apt-get update && apt-get install --no-install-recommends -y python
RUN apt-get update && apt-get install --no-install-recommends -y python \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
https://docs.docker.com/develop/develop-images/instructions/#apt-get
In addition, when you clean up the apt cache by removing /var/lib/apt/lists it reduces the image size, since the apt cache isn’t stored in a layer. Since the RUN statement starts with apt-get update, the package cache is always refreshed prior to apt-get install.
Clean up must be performed in the same RUN step, otherwise it will affect image size.