The context is as follows:
The flow looks as follows:
docker pull repo/image:builder
DOCKER_BUILDKIT=1 docker build . --build-arg BUILDKIT_INLINE_CACHE=1 --target builder --cache-from repo/image:builder --tag repo/image:builder
docker push repo/image:builder
docker pull repo/image:tag
DOCKER_BUILDKIT=1 docker build . --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from repo/image:builder --cache-from repo/image:tag --tag repo/image:tag
docker push repo/image:tag
Dockerfile:
FROM node:8.16.0 as builder
WORKDIR /app
RUN mkdir /app/frontend
COPY frontend/package.json /app/frontend/
WORKDIR /app/frontend
RUN npm install
COPY frontend /app/frontend
RUN npm run build
FROM nginx:1.13.8-alpine
WORKDIR /project/web
COPY --from=builder --chown=nginx:nginx /app/frontend/built /project/web/public
At COPY --from=builder --chown=nginx:nginx /app/frontend/built /project/web/public
the docker build gets stuck forever(30-40 min after which I stop it manually) without error.
EDIT: At the first run, when images are not yet present in the registry, builder caching and COPY --from=builder
works as expected. Only from the second build onwards does it get stuck at COPY --from=builder
I don't know what the problem was but it seems that this tiborvass/docker:19.03.8-dind-bk1413
dind image is stable and runs without hanging forever.