【发布时间】:2017-08-11 21:59:53
【问题描述】:
我正在尝试使用非 root 用户在 docker 映像(从 microsoft/aspnetcore 继承)中运行一个非常简单的 hello world aspnetcore 应用程序,但出现此错误:
暴击:Microsoft.AspNetCore.Server.Kestrel[0] 无法启动 Kestrel。 System.AggregateException:发生一个或多个错误。 (错误 -13 EACCES 权限被拒绝)---> Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: 错误 -13 EACCES 权限被拒绝 Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.ThrowError(Int32 状态码)在 Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.tcp_bind(UvTcpHandle 句柄,SockAddr & addr,Int32 标志)在 Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvTcpHandle.Bind(ServerAddress 地址)在 Microsoft.AspNetCore.Server.Kestrel.Internal.Http.TcpListenerPrimary.CreateListenSocket() 在 Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Listener.b__8_0(对象 状态) --- 从先前抛出异常的位置结束堆栈跟踪 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)在 Microsoft.AspNetCore.Server.Kestrel.Internal.Http.ListenerPrimary.d__12.MoveNext() --- 内部异常堆栈跟踪结束 --- 在 System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) 在 System.Threading.Tasks.Task.Wait(Int32 毫秒超时, CancellationToken 取消令牌)在 Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelEngine.CreateServer(服务器地址 地址)在 Microsoft.AspNetCore.Server.Kestrel.KestrelServer.Start[TContext](IHttpApplication`1 应用) --->(内部异常 #0)Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: 错误 -13 EACCES 权限被拒绝 Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.ThrowError(Int32 状态码)在 Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.tcp_bind(UvTcpHandle 句柄,SockAddr & addr,Int32 标志)在 Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvTcpHandle.Bind(ServerAddress 地址)在 Microsoft.AspNetCore.Server.Kestrel.Internal.Http.TcpListenerPrimary.CreateListenSocket() 在 Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Listener.b__8_0(对象 状态) --- 从先前抛出异常的位置结束堆栈跟踪 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)在 Microsoft.AspNetCore.Server.Kestrel.Internal.Http.ListenerPrimary.d__12.MoveNext()
似乎没有root权限就无法运行aspnetcore,并且在某些安全策略非常受限的场景中,root用户是不允许运行docker镜像的主进程的。
有没有办法以非root用户在linux中运行aspnetcore应用程序?
Sudo 选项无效,因为相同的安全策略。
谢谢,
【问题讨论】:
标签: asp.net-core