...

/

Caching Issues

Caching Issues

Our Dockerfile has a slight issue with how the caching works. In this lesson, we will discuss these caching issues.

Caching issue 1: updating packages

Currently, our Dockerfile has the following two lines:

RUN apt-get update -yqq 
RUN apt-get install -yqq --no-install-recommends nodejs 

Although this works, there is a hidden problem. Let’s say we realize at a later stage that we need to install an extra package, for example, the Vim editor. We add the vim package to the apt-get install RUN instruction, busting the cache and causing that instruction to rerun:

RUN apt-get update -yqq 
RUN apt-get install -yqq
...