Hi, we make heavy use of ONBUILD option in our environment.
Our typical Dockerfile looks like this:
FROM my.company.com/ci/dotnet:v1-build as build
FROM my.company.com/ci/dotnet:v1-runtime
This works fine in legacy docker build, but turning on BUILDKIT option activates some optimizations, so docker tries to build these containers in parallel. The problem is containers are dependent:
-
my.company.com/ci/dotnet:v1-build:
FROM base:v1
WORKDIR /src
ONBUILD COPY . /src
ONBUILD make clean all
-
my.company.com/ci/dotnet:v1-runtime:
FROM runtime:v1
WORKDIR /app
ONBUILD COPY --from=build /src/target /app
Running DOCKER_BUILDKIT=1 docker build . results in:
DOCKER_BUILDKIT=1 docker build .
[+] Building 0.8s (8/8) FINISHED
...
=> ERROR [stage-2 3/1] COPY --from=build /src/target/ /app 0.0s
------
> [stage-2 3/1] COPY --from=build /src/target/ /app:
------
not found: not found
My questions are:
- Can I turn off these optimizations to run builds sequentially?
- Is there a way to mark these stages as dependent explicitly?
Hi, we make heavy use of ONBUILD option in our environment.
Our typical Dockerfile looks like this:
This works fine in legacy docker build, but turning on BUILDKIT option activates some optimizations, so docker tries to build these containers in parallel. The problem is containers are dependent:
my.company.com/ci/dotnet:v1-build:
my.company.com/ci/dotnet:v1-runtime:
Running
DOCKER_BUILDKIT=1 docker build .results in:My questions are: