I am trying to setup a docker container and am using RUN ls
to help debug. However, when I run RUN ls
, docker prints out the following:
---> Using cache
---> 96223b1b0748
I am expecting it to log out files in the folder. Does anyone know what might be happening?
Here is my full Dockerfile:
FROM node:latest
WORKDIR /app
COPY app .
RUN ls
Thanks in advance!
Docker caches recently built layers so that subsequent builds can reuse them.
The simplest way to break this behavior is to use the
--no-cache
flag during build:However this will invalidate all cached layers. If you still want to use cached layers for layers before the
RUN ls
instruction, you can put the following line before it:And then gives this argument a new value on every new build:
Please see this Github issue: https://github.com/moby/moby/issues/22832