By smauer
Here my Dockerfile:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /source
COPY mytestapp-Production-MVC.sln .
COPY mytestapp-Production-MVC/mytestapp-Production-MVC.csproj ./mytestapp-Production-MVC
COPY mytestapp-Production-MVC/ ./
# copy everything else and build app
# COPY mytestapp-Production-MVC/. ./source/mytestapp-Production-MVC
WORKDIR /source/mytestapp-Production-MVC
RUN dotnet restore
RUN dotnet publish -c release -o /app --no-restore
# final stage/image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
WORKDIR /app
COPY --from=build /app ./
EXPOSE 80
ENTRYPOINT ["dotnet", "mytestapp-Production-MVC.dll"]
I get the following ERROR:
mytestapp-production-mvc-live | 16:44:03 INFO[0032] Running: [/bin/sh -c dotnet restore]
mytestapp-production-mvc-live | 16:44:46 error building image: error building stage: failed to execute command: starting command: fork/exec /bin/sh: not a directory
auerdev-production-mvc-live | 16:44:46 exit status 1
I hope someone can help.
Greetings, Sven
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
@smauer đŸ‘‹
This is indeed a strange issue, especially since your Dockerfile looks very similar to our aspdotnet-sample, which is working as expected when I create an app from it.
It’s possible that there is a container layer caching issue happening for your app specifically. If you recreate your app, do you see the same error during build?
@snormoredo Thank you very much. The Dockerfile that you provided works for me.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.