我正在尝试使用非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 statusCode)at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.tcp_bind(UvTcpHandle 手柄,SockAddr& addr,Int32标志)at 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(对象 州) ---从抛出异常的先前位置开始的堆栈跟踪结束--- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务) Microsoft.AspNetCore.Server.Kestrel.Internal.Http.ListenerPrimary.d__12.MoveNext() ---内部异常堆栈跟踪结束---在System.Threading.Tasks.Task.ThrowIfExceptional(布尔值 includeTaskCanceledExceptions)at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, 取消语音取消语言) Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelEngine.CreateServer(ServerAddress 地址) 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 statusCode)at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.tcp_bind(UvTcpHandle 手柄,SockAddr& addr,Int32标志)at 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(对象 州) ---从抛出异常的先前位置开始的堆栈跟踪结束--- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务) Microsoft.AspNetCore.Server.Kestrel.Internal.Http.ListenerPrimary.d__12.MoveNext()< ---
似乎没有root权限就无法运行aspnetcore,并且在安全策略非常有限的某些情况下,root用户不允许运行docker镜像的主进程。
在非root用户的linux下运行aspnetcore应用程序有什么办法吗?
由于相同的安全策略,Sudo选项无效。
谢谢,
答案 0 :(得分:3)
最后问题是我试图使用端口80绑定我的应用程序。如果您使用更高的端口,即5000.权限没有问题。