Why use Docker for .NET web apps when we have WebDeploy?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 19:50:37

问题


In the Microsoft ecosystem, people were happily deploying web apps using WebDeploy Packages until Docker came along. Suddenly everyone started preferring to use Docker instead, with articles being written telling how to WebDeploy into a Docker image.

I've searched this article (and others) for the word "why" and haven't found an explanation, leaving me to infer that the answer is just "because Docker."

I'm probably oversimplifying, but it seems that WebDeploy Packages and Docker images serve similar purposes for deployment, and it's unclear to me why I would want to take a perfectly good WebDeploy Package and put it in a Docker image. What am I missing? What additional benefits does Docker bring above and beyond what we have with WebDeploy? When should I choose one over the other, or use both together?


回答1:


One of docker feature is to record an execution environment in an archive called an image.

That way, you don't have to setup the exact same configuration on a new machine, you can simply run said image on any machine supporting docker, and presumably get the exact same environment execution (same Windows, same Webdeploy version, same IIS, ...)

A WebDeploy Packages is a deployment artifact (like a jar, war, or any other artifacts), which does not include what is needed to run said artifact.

A docker image includes everything already installed, ready to be executed.
You can have the same image used at runtime (docker run) with:

  • different configuration files (through bind mounts or volumes)
  • different environment variable (docker run -e var=value)


来源:https://stackoverflow.com/questions/50769729/why-use-docker-for-net-web-apps-when-we-have-webdeploy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!