kubernetes super bugs in gcloud when create a docker for asp.net

10/8/2019

gcr.io/cloud-builders/docker

build --network cloudbuild --no-cache -t gcr.io/profound-gantry-248310/web-application-6:20191008t124701 .

starting build "4846a80c-e266-4be5-a26f-923fd6918faf"

FETCHSOURCE
Fetching storage object: gs://profound-gantry-248310_cloudbuild/source/1570531687.43-7d2a1597960847598fefb2c8c085dcae.tgz#1570531712041832
Copying gs://profound-gantry-248310_cloudbuild/source/1570531687.43-7d2a1597960847598fefb2c8c085dcae.tgz#1570531712041832...
/ [0 files][ 0.0 B/662.2 KiB] / [1 files][662.2 KiB/662.2 KiB]
Operation completed over 1 objects/662.2 KiB.
BUILD
Already have image (with digest): gcr.io/cloud-builders/docker
Sending build context to Docker daemon 2.831MB
Step 1/17 : FROM mcr.microsoft.com/dotnet/core/aspnet:2.1-stretch-slim AS base
2.1-stretch-slim: Pulling from dotnet/core/aspnet
8f91359f1fff: Pulling fs layer
46d5326a5f0b: Pulling fs layer
bbf7ed56c6a9: Pulling fs layer
47647db0a698: Pulling fs layer
47647db0a698: Waiting
bbf7ed56c6a9: Verifying Checksum
bbf7ed56c6a9: Download complete
46d5326a5f0b: Verifying Checksum
46d5326a5f0b: Download complete
8f91359f1fff: Verifying Checksum
8f91359f1fff: Download complete
47647db0a698: Verifying Checksum
47647db0a698: Download complete
8f91359f1fff: Pull complete
46d5326a5f0b: Pull complete
bbf7ed56c6a9: Pull complete
47647db0a698: Pull complete
Digest: sha256:dff353b27f17c61b6395b82fffd79fcdec25f4d73aefd0640941f1b1b204c396
Status: Downloaded newer image for mcr.microsoft.com/dotnet/core/aspnet:2.1-stretch-slim
---> 0614623158dc
Step 2/17 : WORKDIR /app
---> Running in a17560d643a2
Removing intermediate container a17560d643a2
---> 02ac19cc1cf6
Step 3/17 : EXPOSE 80
---> Running in 831ffb12805e
Removing intermediate container 831ffb12805e
---> 2a3a61807734
Step 4/17 : EXPOSE 443
---> Running in 39ff87802f08
Removing intermediate container 39ff87802f08
---> 0c916835a963
Step 5/17 : FROM mcr.microsoft.com/dotnet/core/sdk:2.1-stretch AS build
2.1-stretch: Pulling from dotnet/core/sdk
Digest: sha256:f04192a946a4473d0001ed9c9422a9e3c9c659de8498778d29bfe6c98672ad9f
Status: Downloaded newer image for mcr.microsoft.com/dotnet/core/sdk:2.1-stretch
---> bf77a711b92c
Step 6/17 : WORKDIR /src
---> Running in dfaa0023b354
Removing intermediate container dfaa0023b354
---> 63346a93e2b3
Step 7/17 : COPY ["WebApplication6.csproj", "WebApplication6/"]
COPY failed: stat /var/lib/docker/tmp/docker-builder990827154/WebApplication6.csproj: no such file or directory
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: exit status 1
-- nikolas kage
asp.net-mvc
docker
gcloud
google-app-engine
kubernetes

1 Answer

10/11/2019

Per @siamsot, you'll get more specific answers with more specific questions :-)

That said, your Dockerfile is insufficient:

FROM mcr.microsoft.com/dotnet/core/aspnet:2.1-stretch-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:2.1-stretch AS build
WORKDIR /src
COPY ["WebApplication6.csproj", "WebApplication6/"]
  1. You're using a so-called multi-stage build (multiple FROM) but there's no benefit in this as you're not transitioning content between stages. I'd expect to see at least COPY --from=base /app/[something] ...
  2. Your final statement COPY ["WebApplication6.csproj"...] is the source of the error. There is no WebApplication6.csproj in the context in this step runs. Because it's the 2 stage of a multi-stage build, I expect to copy this from=base (see above).
  3. Once COPY completes, there's no process that will be run by your container. I would expect to see either ENTRYPOINT (preferably) or CMD as the last step to run your app.

This may help: https://docs.docker.com/engine/examples/dotnetcore/

-- DazWilkin
Source: StackOverflow