我在使用旧版 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
将此应用程序从 Powershell 部署到 IIS 时,我的 docker 文件应该是什么样子?我不明白 VS 正在做什么魔术来完成这项工作?是在构建应用程序还是正在生成某种部署文件?我可以指出的任何示例或示例 Dockerfile 都会很棒。