Docker caches the entire filesystem state after each successful RUN
line.
Knowing that:
RUN
command, comment it out in the Dockerfile (as well as any and all subsequent RUN
commands), then run docker build
and docker run
again.RUN
command, simply add || true
to it to force it to succeed; then proceed like above (keep any and all subsequent RUN
commands commented out, run docker build
and docker run
)Tada, no need to mess with Docker internals or layer IDs, and as a bonus Docker automatically minimizes the amount of work that needs to be re-done.