我在我的应用程序中使用以下脚本创建了一个图像Dockerfile
,但是当我使用容器的 IP 地址和端口(2000)浏览时,我收到 403 - Forbidden:访问被拒绝。我使用的是 Windows 10.0.14393 Build 14393,适用于 Windows 的 Docker 桌面。该项目是一个 ASP.NET 解决方案,包含 Nancy、Entity Framework、AngularJS 和 SQL Server 项目。我是否需要对 IIS、Docker、Powershell 等进行任何配置更改?我的 Dockerfile 脚本是:
FROM microsoft/aspnet:windowsservercore
# using powershell commands
SHELL ["powershell"]
# location of the source directory
WORKDIR C:/src/Project
# run project using port 2000
RUN Remove-Website -Name 'Default Web Site'; \
New-Website -Name 'Project' -Port 2000 -PhysicalPath 'C:/src/Project'
确保您的文件不会在 .dockerignore 中被忽略
复制这个 Dockerfile
FROM microsoft/aspnet
WORKDIR /inetpub/wwwroot
COPY . /inetpub/wwwroot
# Give Full Access To Folder
RUN icacls 'c:/inetpub/wwwroot' /grant 'Everyone:(OI)(CI)F'
# Check that the files have been successfully copied
RUN dir
- docker build -t 测试。
- docker run -p 8001:80 测试
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)