简体   繁体   English

Windows Docker 图像没有 inte.net 访问权限

[英]Windows Docker image has no internet access

I have an application written in Net 5 Core, but the dependencies must work on the Windows platform and I must use Windows containers.我有一个用 Net 5 Core 编写的应用程序,但依赖项必须在 Windows 平台上运行,我必须使用 Windows 容器。 Some values for the application to work are stored in the Azure database.应用程序工作的一些值存储在 Azure 数据库中。 After the build of the image, I launch the container and it crashes due to the inability to read the data from the base.构建映像后,我启动了容器,但由于无法从基础读取数据而崩溃。 Other applications that can be run under Linux they can read values from the base.可以在 Linux 下运行的其他应用程序可以从基数中读取值。 Perhaps there are some firewall settings that need to be implemented and Windows images so that they can work?也许需要实施一些防火墙设置和 Windows 图像才能工作?

FROM mcr.microsoft.com/dotnet/aspnet:5.0-nanoserver-1809 AS base
#FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80


FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src


COPY ["/src/Configurations/appsettings.json", "Configurations/"]
COPY ["/src/TestEngine/.", "TestEngine/"]


RUN dotnet restore "TestEngine/TestEngine.App/TestEngine.App.csproj"
COPY . .
WORKDIR "TestEngine/TestEngine.App/"
RUN dotnet build "TestEngine.App.csproj" -c Release -o /app/build  --no-restore

FROM build AS publish
RUN dotnet publish "TestEngine.App.csproj" -c Release -o /app/publish  --no-restore

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .

ENTRYPOINT ["dotnet", "TestEngine.App.dll"]

error错误

System.ArgumentNullException: Value cannot be null. (Parameter 'uriString')
   at System.Uri..ctor(String uriString)
   at TestEngine.App.Startup.ConfigureServices(IServiceCollection services) in C:\src\TestEngine\TestEngine.App\Startup.cs:line 80
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)

Thanks)谢谢)

There seems to be several different things that break inte.net for windows containers.似乎有几种不同的东西破坏了 windows 容器的 inte.net。 What solved it for me a few times was a "docker.network prune" followed by restarting the computer, so it recreates it's default.networks.几次为我解决的是“docker.network prune”,然后重新启动计算机,因此它重新创建了 default.networks。

A less destructive option was using the "Default Switch".network in your commands, like:一个破坏性较小的选项是在您的命令中使用“默认开关”.network,例如:

docker run --network "Default Switch" ...
docker build --network "Default Switch" ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Docker 映像构建 Windows 10 上的“访问被拒绝”错误 - Docker image build "Access is denied” error on Windows 10 Docker 群容器无法访问 inte.net - Docker swarm containers not able to access internet 从不同项目访问 GCP Docker 图像 - Access GCP Docker image from different project 如何访问 docker 图像的 Dockerfile? - How to get access to Dockerfile of a docker image? 每个 docker 图像都需要有自己的集群、任务定义、目标组和来自面向负载均衡器的应用程序 inte.net 的路径吗? - Is every docker image need to have their own cluster, task definition, target group and path from application internet facing load balancer? 如何将 MS Access 驱动程序安装到我的 docker 图像? 或者还有其他解决此问题的方法吗? - How to install MS Access Driver to my docker image? Or is there any other work around this problem? EC2 实例无法访问 inte.net - EC2 instance can’t access the internet AWS SageMaker Estimator 无法访问 inte.net - AWS SageMaker Estimator cannot access the internet 如何使用 nat 网关限制 VPC 中的 inte.net 访问? - How to restrict internet access in a VPC with a nat gateway? Lambda Docker 图像未运行 - Lambda Docker Image Not Running
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM