profile
viewpoint

Ask questionsRUN --mount=type=cache causes the whole build context to be loaded in

We're using buildkit because it drastically reduces the size of the build context that needs to be copied across during builds. However, it looks like RUN --mount=type=cache causes the entire build context to be copied for some reason.

Before:

COPY something /something
WORKDIR /something/
RUN go build
=> [internal] load build context                                                                                                                                                 0.1s  
=> => transferring context: 1.27MB                                                                                                                                               0.0s

After:

COPY something /something
WORKDIR /something/
RUN --mount=type=cache,target=/.cache go build
=> [internal] load build context                                                                                                                                               103.3s  
=> => transferring context: 5.28GB                                                                                                                                             103.3s
...

This is on Windows 10 with experimental features enabled in Docker.

moby/buildkit

Answer questions xkszltl

I even tried the docker-ce nightly (2019-07-19), and that seems working, but not always. There were several times where I got failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: frontend grpc server closed unexpectedly image

useful!
source:https://uonfu.com/
Github User Rank List