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
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
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP