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:
docker build --no-cache ...
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:
ARG CACHE_TS=default_ts
And then gives this argument a new value on every new build:
docker build --build-arg CACHE_TS=$(date +%s) ...
Please see this Github issue: https://github.com/moby/moby/issues/22832
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With