I have an ASP.Net Framework 4.8 project. I want to create a Linux-based Docker file for this project, but I can’t find a Linux-based image to use as a base image in my Docker file for .NET Framework. How can I create a Docker file for this?
I have an ASP.Net Framework 4.8 project. I want to create a Linux-based Docker file for this project, but I can’t find a Linux-based image to use as a base image in my Docker file for .NET Framework. How can I create a Docker file for this?
2
Answers
Finally, after a week of trying, I was able to get an answer.
We have to base the image on Nginx and install the mono on it.
dist
folder.sites-available
name.default
name and the following codes:fastcgi_params
name and the following codes:sample.webapp
name and the following codes:supervisord.conf
file:.NET Framework is not cross-platform. Neither is ASP.NET itself. They do not work on Linux. So there are no Linux-based container images that would let you run .NET Framework or ASP.NET Framework.
And you can not make a custom one; .NET Framework will simply not run on Linux.
That’s why Microsoft created .NET Core (and now just called .NET) and ASP.NET Core, so they would be cross-platform and you could use those on Linux, including Linux-based container images.
As suggested in some comments, you might be able to use mono. Mono is a (not really supported) implementation of .NET Framework that aims to work on Linux. It’s not 100% bug for bug compatible with .NET Framework, so your application may or may not work with it.
A better, but more difficult option, would be to port your application to ASP.NET Core 6, which is supported on Linux-based containers.