For aspnet docker images whats the difference between servercore tag and nanoserver tag?

huangapple go评论68阅读模式
英文:

For aspnet docker images whats the difference between servercore tag and nanoserver tag?

问题

I'm deploying for the first time my company's application to a docker container. We have developed a .NET 6 application and have been deploying it to their instance of IIS server for the past couple of years.

我们首次将公司的应用程序部署到Docker容器中。我们开发了一个.NET 6应用程序,过去几年一直将其部署到IIS服务器的实例中。

We decided to attempt to move it to a docker container and I have been struggling since. First, I tried using a pure nanoserver image, then due to Windows dependencies in the application, moved up to the Windows image itself while installing .NET SDK and VC_redist within the container. The image ended up with 15GB, and the dotnet build time was very slow.

我们决定尝试将其移至Docker容器中,但我一直在努力。首先,我尝试使用纯粹的nanoserver映像,然后由于应用程序中的Windows依赖性,移至了Windows映像本身,同时在容器内安装了.NET SDK和VC_redist。映像最终达到了15GB,并且dotnet构建时间非常缓慢。

Some weeks later I discovered that aspnet image has tags with nanoserver and windowscore. Since the discovery, work was done to rebuilding a Dockerfile using such images. The application successfully starts with each tag, but the nanoserver version crashes when loading a Db2 dll. This behavior does not happen with aspnet image tagged with servercore. Also, there was no need to install vc_redist. I've attempted to copy some DLLs from vc_redist into nanoserver without success.

几周后,我发现aspnet映像具有nanoserver和windowscore标签。自从发现以来,我们已经使用这些映像重建了Dockerfile。该应用程序使用每个标签成功启动,但nanoserver版本在加载Db2 dll时崩溃。这种情况在带有servercore标签的aspnet映像上不会发生。此外,无需安装vc_redist。我尝试将一些DLL从vc_redist复制到nanoserver中,但没有成功。

Why is this happening? Is there a way to copy necessary files into nanoserver?

为什么会发生这种情况?有没有办法将必要的文件复制到nanoserver中?

The image I'm using is this.

我使用的映像是this

It would be great using the nanoserver tag as its size is around 700MB versus 4GB of the servercore tag.

使用nanoserver标签将会很好,因为其大小约为700MB,而servercore标签则为4GB。

Haven't tried the runtime image yet - don't even know if it's worth the attempt.

我还没有尝试运行时映像 - 甚至不知道是否值得尝试。

TLDR: Can't ship .NET 6 app correctly to aspnet nanoserver image, but it's working on aspnet servercore. Why is this happening? What can be done to make it work?

简而言之:无法正确将.NET 6应用程序部署到aspnet nanoserver映像中,但在aspnet servercore上可以正常工作。为什么会发生这种情况?有什么办法可以使其正常工作?

英文:

Im deploying for the first time my company's application to a docker container. Se developed a .net 6 aplicatiom amd have been deploying it to their instance of IIS server for the past couple years.

We decided to attempt to move it to a docker container and I have been struggling since. First I tried using pure nanoserver image, than due to windows dependencies in the application moved up to windows image itself while installing .net sdk and vc_redist within the container. The image ended up with 15GB and the dotnet build time was very slow.

Some weeks later I discovered that aspnet image has tags with nanoserver and windowscore. Since the discovery, work was done to rebuilding a dockerfile using such images. The application sucessfully starts with each tag, but the nanoserver version crashes when loading a Db2 dll. This behavior does not happen with aspnet image tagged with servercore. Also, there was no need to install vc_redist. Ive attempted to copy some DLLs from vc_redist into nanoserver without success.

Why is this happening? Is there a way to copy necessary files into nanoserver?

The image im using is this.

It would be great using the nanoserver tag as its size is around 700MB versus 4GB of the servercore tag.

Havent tried the runtime image yet - dont even know if its worth the attempt.

TLDR: Cant ship .net 6 app correctly to aspnet nanoserver image, but its working on aspnet servercore. Why is this happening? What can be done to make it work?

答案1

得分: 1

基本上,Nano Server、Server Core 和完整的 Windows(Server)容器映像之间的区别仅在于它们提供的文件集合。Nano Server 是最小的,可以满足许多应用程序场景,但它缺少某些特定应用程序可能需要的文件。例如,Nano Server 没有 security.dll,但 Server Core 中存在。当你从 Nano Server 到 Server Core 再到完整的 Windows 映像逐渐升级时,你会获得越来越多的文件和功能。

采取的一般方法是使用你的应用程序所需的最小的 Windows 基础映像。从 Nano Server 开始,验证你的应用程序的功能。如果一切正常,就使用它。如果不行,尝试使用 Server Core。如果还不行,你只能使用完整的 Windows 映像了。

英文:

Basically, the difference between Nano Server, Server Core, and the full Windows (Server) container image is just the set of files they provide. Nano Server is the smallest and can fulfill a lot of app scenarios but it is missing certain files that a specific app may require. For example, Nano Server doesn't have security.dll but it does exist in Server Core. As you move up from Nano Server to Server Core to the full Windows image, you get increasingly more files/functionality.

The general approach to take is to use the smallest Windows base image that your app requires. Start with Nano Server and validate your app's functionality. If everything works, use that. If not, try Server Core. And if that still doesn't work, you're left with the full Windows image behemoth.

huangapple
  • 本文由 发表于 2023年5月25日 18:28:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/76331296.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定