When using docker run .
, or docker run . --progress=plain
and a particular layer fails, is there a way to access the file system of the failed layer?
Example
Suppose a layer looks like this (the exact command is arbitrary; it could be anything that fails):
# ...
#33 [29/33] RUN npm install
#33 sha256:599d402aaf6065b9838c298e599bf00abb7ec8f895b0cba63c7a3e4b7ca6dd58
# ...
#30 15.50 npm ERR! A complete log of this run can be found in:
#30 15.50 npm ERR! /root/.npm/_logs/2022-11-15T03_32_30_527Z-debug.log
#30 ERROR: executor failed running [/bin/sh -c npm install]: exit code: 1
An informative message says to look in /root/.npm/_logs/2022-11-15T03_32_30_527Z-debug.log
for some messages, which could be very helpful. But how can that file be accessed? (since the layer in which that file was generated failed, the layer cannot be found using docker history
. Nor can it be accessed by running the image, since (I believe) a failed build will not result in an image available via docker image ls
.