5

I am using the latest version of Docker Desktop on Windows (Docker Engine version v19.03.13).

After the last update, the output of docker build . has changed! It is now harder to debug what is going on.

Here is my Dockerfile:

# set base image as the dotnet 3.1 SDK.
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env

# set the working directory for any RUN, CMD, ENTRYPOINT, COPY and ADD
# instructions that follows the WORKDIR instruction.
WORKDIR /app

# debug purposes - see where we are
RUN pwd

# our current working directory within the container is /app
# we now copy all the files (from local machine) to /app (in the container).
COPY . ./

# debug purposes - list files in current folder
RUN ls -la

# run unit tests within the solution.
RUN dotnet test Phoneden.sln

# again, on the container (we are in /app folder)
# we now publish the project into a folder called 'out'.
RUN dotnet publish Phoneden.Web/Phoneden.Web.csproj -c Release -o out

# debug purposes - list files in current folder
RUN ls -la

# set base image as the dotnet 3.1 runtime.
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS runtime

# telling the application what port to run on.
ENV ASPNETCORE_URLS=http://*:5005

# set the working directory for any RUN, CMD, ENTRYPOINT, COPY and ADD
# instructions that follows the WORKDIR instruction.
WORKDIR /app

# copy the contents of /app/out in the `build-env` and paste it in the
# `/app` directory of the new runtime container.
COPY --from=build-env /app/Phoneden.Web/out .

# set the entry point into the application.
ENTRYPOINT ["dotnet", "Phoneden.Web.dll", "-seed"]

When I run docker build --no-cache . I get the following:

jwan@home-desktop MSYS /c/code/phoneden (upgrade/net-3.1)
$ docker build --no-cache .
[+] Building 38.9s (16/16) FINISHED
 => [internal] load .dockerignore                                                                                                                                                                                                                                                  0.1s
 => => transferring context: 35B                                                                                                                                                                                                                                                   0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                               0.0s
 => => transferring dockerfile: 32B                                                                                                                                                                                                                                                0.0s
 => [internal] load metadata for mcr.microsoft.com/dotnet/core/aspnet:3.1                                                                                                                                                                                                          0.0s
 => [internal] load metadata for mcr.microsoft.com/dotnet/core/sdk:3.1                                                                                                                                                                                                             0.0s
 => [internal] load build context                                                                                                                                                                                                                                                  0.3s
 => => transferring context: 96.50kB                                                                                                                                                                                                                                               0.2s
 => [build-env 1/8] FROM mcr.microsoft.com/dotnet/core/sdk:3.1@sha256:1d96e460ac4af00ffc41c5d4a27b503f2589098c84b6ca10d09e0f7ef6e31689                                                                                                                                             0.0s
 => [runtime 1/3] FROM mcr.microsoft.com/dotnet/core/aspnet:3.1@sha256:41ece4e6218d5f2c66191c4bd8b8dda060ea3b1512353fe1185e239121458ab5                                                                                                                                            0.0s
 => CACHED [build-env 2/8] WORKDIR /app                                                                                                                                                                                                                                            0.0s
 => CACHED [runtime 2/3] WORKDIR /app                                                                                                                                                                                                                                              0.0s
 => [build-env 3/8] RUN pwd                                                                                                                                                                                                                                                        0.3s
 => [build-env 4/8] COPY . ./                                                                                                                                                                                                                                                      0.3s
 => [build-env 5/8] RUN ls -la                                                                                                                                                                                                                                                     0.3s
 => [build-env 6/8] RUN dotnet test Phoneden.sln                                                                                                                                                                                                                                  17.7s
 => [build-env 7/8] RUN dotnet publish Phoneden.Web/Phoneden.Web.csproj -c Release -o out                                                                                                                                                                                         19.5s
 => [build-env 8/8] RUN ls -la                                                                                                                                                                                                                                                     0.6s
 => ERROR [runtime 3/3] COPY --from=build-env /app/Phoneden.Web/out .                                                                                                                                                                                                              0.0s
------
 > [runtime 3/3] COPY --from=build-env /app/Phoneden.Web/out .:
------
failed to solve with frontend dockerfile.v0: failed to build LLB: failed to compute cache key: "/app/Phoneden.Web/out" not found: not found

As you can see, it is not listing the result of the debug commands I added.

How can I get the output to be verbose like it was before the update?

7

This is the output from buildkit. You can run buildkit based builds with a different output syntax:

$ docker build --help
...
  --progress string         Set type of progress output (auto, plain, tty). Use plain to show container output
                            (default "auto")

In your command, that would be:

docker build --progress=plain .

Or you can disable buildkit by setting DOCKER_BUILDKIT=0 in your shell:

DOCKER_BUILDKIT=0 docker build .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.