我在使用旧版asp.net Web应用程序手动构建和运行Windows Server核心容器时遇到问题。在Visual Studio中,我可以使用自动生成的dockerfile / yml文件运行容器。
我想使用dockerfile而不是Visual Studio进行docker build和docker run powershell命令。
这是当前的yml文件:
version: '3'
services:
fulldotnetwebapplication:
image: fulldotnetwebapplication
build:
context: .\FullDotNetWebApplication
dockerfile: Dockerfile
这是当前的dockerfile:
FROM microsoft/aspnet:4.7.1-windowsservercore-ltsc2016
ARG source
WORKDIR /inetpub/wwwroot
COPY ${source:-obj/Docker/publish} .
假设我的ASP项目是FullDotNetWebApplication,它包含App_Data,Content,Controllers等文件夹以及Master / ASPX页面以及web / packages / config。
我为我的Dockerfile尝试了这个:
FROM microsoft/aspnet:4.7.1-windowsservercore-ltsc2016
WORKDIR /inetpub/wwwroot
COPY . .
COPY ./bin ./bin
并收到此错误:
docker : COPY failed: GetFileAttributesEx \\?\C:\Windows\TEMP\docker-builder977521850\bin: The system cannot find the file specified.
At line:1 char:1
+ docker build -t fulldotnetwebapplication .
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (COPY failed: Ge...file specified.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
我的docker文件应如何将此应用程序从Powershell部署到IIS?我不明白魔术VS正在做什么以使它起作用?它是构建应用程序还是生成某种部署文件?我可以指出的任何示例或示例Dockerfile都会很棒。
最佳答案
这些可能会帮助您指出正确的方向:
https://blog.alexellis.io/run-iis-asp-net-on-windows-10-with-docker/
https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/quick-start-images
https://www.red-gate.com/simple-talk/sysadmin/virtualization/working-windows-containers-docker-running/
https://sarafian.github.io/2017/02/14/docker-windows-full-asp.net-application.html
您需要在Docker文件中包括的第一件事是[SHELL]配置。还要检查Docker PowerShell命令
关于asp.net - 将ASP.Net应用程序部署到Window Server Core容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48348696/