在 docker 容器内创建网络命名空间时出现错误,提示权限被拒绝。
command
ip netns add red
Run Code Online (Sandbox Code Playgroud)
error
mount --make-shared /run/netns failed: Permission denied
Run Code Online (Sandbox Code Playgroud)
我正在运行图像 ubuntu:20.10 并尝试向容器添加特定功能,但没有帮助。
docker run -it --rm --name=ubuntu --cap-add CAP_SYS_ADMIN --cap-add NET_ADMIN ubuntu:20.10
apt-get update && apt-get install -y net-tools && apt-get install -y iproute2
Run Code Online (Sandbox Code Playgroud)
即使添加所有功能后,问题仍然相同。
docker run -it --rm --name=ubuntu --cap-add ALL ubuntu:20.10
Run Code Online (Sandbox Code Playgroud) 我正在使用Select.HtmlToPdf.NetCore(18.3.0)在Dotnetcore 2.1中将HTML转换为pdf。它可以在本地环境中完美运行,但是当与Docker托管时,会引发错误消息,
{“ fileName”:“ System.TypeInitializationException:'Gdip'的类型初始值设定项引发了异常。---> System.DllNotFoundException:无法加载共享库'libdl'或其依赖项之一,以帮助诊断加载问题,请考虑设置LD_DEBUG环境变量:liblibdl:无法打开共享对象文件:Interop.Libdl.dlopen(字符串文件名,Int32标志)处没有这样的文件或目录\ n,System.Drawing.SafeNativeMethods.Gdip.LoadNativeLibrary() \ n在System.Drawing.SafeNativeMethods.Gdip..cctor()\ n-内部异常堆栈跟踪的结尾--- \ n在System.Drawing.SafeNativeMethods.Gdip.GdipNewPrivateFontCollection(IntPtr&fontCollection)\ n在SelectPdf。 Lib.?..ctor()\n在SelectPdf.Lib.?..ctor()\n在SelectPdf.Lib.?..ctor(?A_0,?A_1)\ n
在SelectPdf.HtmlToPdf.ConvertHtmlString(String htmlString)处(字符串A_0,字符串A_1,字符串A_2,字符串A_3,布尔值A_4)\ n
我尝试通过在Dockerfile中添加这些行集来进行尝试,但是仍然存在相同的错误。
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
RUN apt-get update
RUN apt-get install -y apt-utils
RUN apt-get install -y libgdiplus
RUN ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll
WORKDIR /app
EXPOSE 80
Run Code Online (Sandbox Code Playgroud) 我正在通过安装一些绘图包来创建自定义 Dockerfile。我无法在 Dockerfile 中安装 libgdiplus-dev 包。我尝试在 Dockerfile 中添加镜像 URL https://pkgs.alpinelinux.org/package/edge/testing/armhf/libgdiplus- (可以在此 URL 中找到镜像) dev 但没有帮助。
FROM alpine:3.7
RUN apk add --no-cache libgdiplus-dev
Run Code Online (Sandbox Code Playgroud)
运行上面的命令最终我说
libgdiplus-dev (missing):
required by: world[libgdiplus-dev]
Run Code Online (Sandbox Code Playgroud)