Docker: apt-get cleanup

Reading Time: < 1 minute

If you install things with apt-get remember to clean it up afterwards

RUN apt-get clean && rm -f /var/lib/apt/lists/*_*

This would be a better way:

RUN apt-get update -y \
&& apt-get install -y -q package1 \
package2 \
package3 \
&& apt-get clean && rm -f /var/lib/apt/lists/*_*

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.