AnswerBun.com

Cannot build Dockerfile

Stack Overflow Asked by user1765862 on December 14, 2020

Folder structure:

        Honda.Domain/
          Honda.Domain.csproj
        Honda.API/
          Honda.API.csproj
        Dockerfile

Dockerfile

FROM mcr.microsoft.com/dotnet/core/sdk:3.1 
    WORKDIR /app 
    
    # copy csproj and restore as distinct layers
    COPY ./Honda.Domain/Honda.Domain.csproj ./Honda.Domain/
    COPY ./Honda.API/Honda.API.csproj Honda.API/
    
    RUN dotnet restore Honda.API/Honda.API.csproj
    
    # copy everything else and build app
    COPY . ./
    WORKDIR /app/Honda.API/
    RUN dotnet publish -c Release -o publish/
    
    FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
    WORKDIR /app
    COPY --from=build /app/Honda.API/publish  .
    
    ENV ASPNETCORE_URLS=https://+:5001;http://+:5000 
    ENTRYPOINT ["dotnet", "Honda.API.dll"]

Trying to build using command:

docker build -t honda-api:build .

Step 17/19 : COPY –from=build /app/Honda.API/publish .

invalid from flag value build: pull access denied for build,
repository does not exist or may require ‘docker login’: denied:
requested access to the resource is denied

One Answer

You are using the --from flag which is supposed to copy something from a previous stage build.

Optionally COPY accepts a flag --from=<name> that can be used to set the source location to a previous build stage (created with FROM .. AS <name>) that will be used instead of a build context sent by the user. In case a build stage with a specified name can’t be found an image with the same name is attempted to be used instead.

Read here first about multi stage builds: https://docs.docker.com/develop/develop-images/multistage-build/

If this is what you are trying to achieve you should modify your first line to be like: FROM mcr.microsoft.com/dotnet/core/sdk:3.1 as build

Correct answer by J-Mous on December 14, 2020

Add your own answers!

Related Questions

How to get a thread dump of a running Node.js process?

3  Asked on December 23, 2020 by philipp-claen

       

Jquery Select all IDs in different Sections

1  Asked on December 23, 2020 by abcid-d

     

Can’t merge two dictionaries into one dictionary

3  Asked on December 23, 2020 by yoel-regen

 

Sharing Power BI Dashboards – External Users

1  Asked on December 23, 2020 by datageek

 

SQL query to loop through records

1  Asked on December 22, 2020 by doe

         

Is there a better way to implement nested setTimeouts()

1  Asked on December 22, 2020 by dashman

 

CMYK image being converted to RGB

0  Asked on December 22, 2020 by entity

     

Bootstrap Toast at bottom right of page

1  Asked on December 22, 2020 by sean-thorburn

     

I doesn’t receive any formated data from static class

0  Asked on December 21, 2020 by asfdasfdsfdfsd

     

SQL Notes: Hackerrank The Report Query how to save the subquery variable

3  Asked on December 21, 2020 by varad-paralikar

 

NEO4J gives node count as negative

0  Asked on December 21, 2020 by ck22

     

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP