我想在 docker 容器中创建一个 ASP.NET Core 2.0 网站并将其托管在 Linux VPS docker 系统上。我尝试在 Visual Studio 中创建一个 ASP.NET Core 2.0 项目,然后将其发布到 docker hub。一切都很好,直到我想在我的 Linux 环境中运行那个 docker 镜像。然后我收到一条错误消息,说这个图像是为 Windows 或类似的东西创建的。我知道我需要在 Linux 环境中创建 asp.net 项目,然后开始编码(很明显),但我想在 我的 PC 上使用 Visual Studio 进行编码,而不是通过 PICO 或一些其他的 ssh 连接的编辑器。
总结:
- I wish to run ASP.NET Core 2.0 website on Linux Docker VPS environment.
- I (think I) need to create the project in the Linux environment (I run Windows locally).
- Wish to edit the code in the docker container locally on my Windows environment.
有人知道我怎样才能做到这一点吗?
最佳答案
在您的 Windows 操作系统上创建 ASP.NET Core 2 网站之前,右键单击系统托盘中的 Docker 图标,然后单击 切换到 Linux 容器
。切换到 Linux 容器后,创建可以在 Linux 上托管的 ASP.NET Core 网站。
关于linux - 在 Windows 上的 Docker 容器中编辑 ASP.NET Core 网站并在 Ubuntu VPN 上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51106558/