Dockerfile - repository does not exist or may require 'docker login

Viewed 55

I'm following this tutorial and this is my Dockerfile

FROM public.ecr.aws/lambda/dotnet:core3.1 AS base  
  
FROM mcr.microsoft.com/dotnet/sdk:3.1 as build  
WORKDIR /src  
COPY ["s3Listener.csproj", "base/"]  
RUN dotnet restore "base/s3Listener.csproj"  
  
WORKDIR "/src"  
COPY . .  
RUN dotnet build "s3Listener.csproj" --configuration Release --output /app/build  
  
FROM build AS publish  
RUN dotnet publish "s3Listener.csproj" \  
            --configuration Release \   
            --runtime linux-x64 \  
            --self-contained false \   
            --output /app/publish \  
            -p:PublishReadyToRun=true    
  
FROM base AS final  
WORKDIR /var/task  
COPY --from=publish /app/publish .  
CMD ["s3Listener::s3Listener.Function::FunctionHandler"]  

when I try to build an image using

docker build -t s3listener .

Step 11/14 : FROM base AS final pull access denied for base, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

What I'm doing wrong here?

1 Answers

The Issue here :

FROM public.ecr.aws/lambda/dotnet:core3.1 AS base 

may you use the following with considering the dotnet version?

public.ecr.aws/lambda/dotnet:6

as this error has a lot of meaning

  1. it really requires a login before the command docker build in case you confirm that this is an image only contained on your repos
  2. Misspelling in your image name after from or the image name you make it from
Related