Hi all,
This may be a naive question, but…
When I pull an image from the docker registry, do I also get the benefits of any docker caching (i.e. intermediary layers) when I try to re-build that same image (locally)?
e.g.
Given the Dockerfile …
FROM alpine
COPY . .
RUN ls -la
If it’s built remotely and published to a registry, then I docker pull deleteme:latest
the image to my local machine, and try to build docker build . --tag deleteme
, assuming my local directory (checksum?) isn’t different from where it was built, will the build have access to the existing cache (I assume these are docker images?).
i.e.
$ docker build . --tag deleteme
Sending build context to Docker daemon
Step 1/3 : FROM alpine
---> cdf98d1859c1
Step 2/3 : COPY . .
---> Using cache
---> 45541c2f74df
Step 3/3 : RUN ls -la
---> Using cache
---> eda2a2c93544
Successfully built eda2a2c93544
Successfully tagged deleteme:latest
REPOSITORY TAG IMAGE ID CREATED
deleteme latest eda2a2c93544 About a minute ago
<none> <none> d6f5782e1c09 2 minutes ago <-- is cache?/shared?
(Obviously d6f5782e1c09
doesn’t match 45541c2f74df
and eda2a2c93544
)
--cache-from
seems interesting, but not sure it works with a remotely pulled image?
Follow up question: If not, then where is the cache stored, and can it be shared somehow?
Kind regards,
Nick