Karamzov
Karamzov

Reputation: 403

docker build fails with access denied or repository not exist

My dockerfile

FROM microsoft/aspnetcore-build AS build-env
WORKDIR /app

# copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore

# copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o output

# build runtime image
FROM microsoft/aspnetcore
WORKDIR /app
COPY --from=build-env /app/output .
ENTRYPOINT ["dotnet", "LetsKube.dll"]

While trying to execute the above its give an error

failed to solve with frontend dockerfile.v0: failed to create LLB definition: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed

steps i tried :

  1. Changed base to mcr.microsoft.com/dotnet/core/sdk:2.2

How to solve this and build and image for aspnet 2.0 framework apps?

Upvotes: 1

Views: 3782

Answers (1)

BleepingNoise
BleepingNoise

Reputation: 91

Your referenced repos "microsoft/aspnetcore-build" and "microsoft/aspnetcore" are the problem here, since they don't exists/are available in the public docker hub.

You can check for available tags for .NET SDK here.

You can check for available tags for .NET Runtime here.

You could try with something like this, according to your Dockerfile:

FROM mcr.microsoft.com/dotnet/sdk:2.1.816-stretch AS build-env
WORKDIR /app

# copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore

# copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o output

# build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:2.1.28-stretch-slim
WORKDIR /app
COPY --from=build-env /app/output .
ENTRYPOINT ["dotnet", "LetsKube.dll"]

You could also start experimenting with the different images listed in the attached links, so you find what works better for you.

Upvotes: 2

Related Questions