运行Docker镜像会导致Kestrel异常
当我尝试在Linux操作系统中运行我的Docker镜像时,我正面临奇怪的行为 – 图像包含.Net核心Web API项目
这是我的Program.cs
var host = new WebHostBuilder() .UseKestrel().UseStartup<Startup>().Build(); host.Run();
我的Docker-compose.yml文件
version: '2' services: server: image: repo.testCompany.com:1443/testCompany:6 ports: - "60000:60000" hostname: ucp.${HOST_HOSTNAME} restart: unless-stopped
图像被构建并推送成功。当Web API尝试运行容器内的项目并引发运行时异常时,问题就出现了 –
Unhandled Exception: System.AggregateException: One or more errors occurred. (Error -99 EADDRNOTAVAIL address not available) ---> Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -99 EADDRNOTAVAIL address not available at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.Check(Int32 statusCode) at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.tcp_bind(UvTcpHandle handle, SockAddr& addr, Int32 flags) at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvTcpHandle.Bind(ServerAddress address) at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.TcpListener.CreateListenSocket() at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Listener.<>c.<StartAsync>b__6_0(Object state) --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait() at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelEngine.CreateServer(ServerAddress address) at Microsoft.AspNetCore.Server.Kestrel.KestrelServer.Start[TContext](IHttpApplication`1 application) at Microsoft.AspNetCore.Hosting.Internal.WebHost.Start() at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host, CancellationToken token, String shutdownMessage) at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host) at Exactor.XeroConnector.API.Program.Main(String[] args)
主要的问题是,我的本地机器上没有重现错误,但只有当图像是通过Jenkins构建和上传的时候。 你可以请别人提出建议吗?
Tnx为答案的问题是詹金斯莫名其妙地是不发布最新的形象….