我尝试创建一个内部带有asp net核心应用程序的Windows容器。我的应用程序已连接到Oracle数据库。 我有一个可以工作的linux dockerfile。我尝试将其迁移到Windows泊坞窗(以将映像集成到本地服务矩阵群集中),但是映像无法连接到数据库。 当我运行容器时,会显示以下消息:
Unhandled Exception: Devart.Data.Oracle.OracleException: ORA-12545: Connect failed because target host or object does not exist
这是我的Windows dockerfile:
FROM mcr.microsoft.com/powershell:nanoserver-1803 AS downloadnodejs
SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop';$ProgressPreference='silentlyContinue';"]
RUN Invoke-WebRequest -OutFile nodejs.zip -UseBasicParsing "https://nodejs.org/dist/v10.16.3/node-v10.16.3-win-x64.zip"; `
Expand-Archive nodejs.zip -DestinationPath C:\; `
Rename-Item "C:\node-v10.16.3-win-x64" c:\nodejs
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-nanoserver-1803 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
EXPOSE 1521
COPY --from=downloadnodejs C:\nodejs\ C:\Windows\system32\
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-nanoserver-1803 AS build
COPY --from=downloadnodejs C:\nodejs\ C:\Windows\system32\
WORKDIR /src
COPY ["Web/Magistor.Core.Web/Magistor.Core.Web.csproj", "Web/Magistor.Core.Web/"]
/** SOME COPY **/
RUN dotnet restore "Web/Magistor.Core.Web/Magistor.Core.Web.csproj"
COPY . .
WORKDIR "/src/Web/Magistor.Core.Web"
RUN dotnet build "Magistor.Core.Web.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Magistor.Core.Web.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Magistor.Core.Web.dll"]
有人可以帮助我吗? 谢谢你。