docker之使用System.Drawing生成图片缺少Gdiplus.dll错误
2017-10-30 17:07 huoit 阅读(1861) 评论(0) 编辑 收藏 举报Windows下面运行正常,部署到Linux的docker上之后,报错显示缺少gdiplus.dll;这个是Windows的gdi组件,在Linux下要安装环境
解决方法一
修改Dockerfile;添加gidplus组件的安装:
RUN apt-get update
RUN apt-get install libgdiplus
完整如下:
#依赖原始的镜像,dotnet镜像根据实际版本下载好 FROM microsoft/dotnet:1.1.4-sdk ## 时区设置,默认是【格林威治时间】 #ENV TZ=Asia/Shanghai #RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone # RUN apt-get update RUN apt-get install libgdiplus #设置COPY命令的工作目录 WORKDIR /app # 把当前目录的文件复制到【root】目录下去 COPY . /app/ # 镜像对外监听端口 EXPOSE 9001 # dotnet coer 命令启动入口DLL文件 ENTRYPOINT ["dotnet", "DotnetCoreQrcoderTest.dll"]
解决方法二
直接修改基础镜像后制作成自己的镜像
进行镜像对应的容器
docker run -it container01
docker exec -ti container01 /bin/bash
apt-get install libgdiplus
(如果失败,先运行apt-get update 在运行上面的命令)
exit
docker commit container01 myimages/aspnetcore:2.0
( docker save container01 > lind_aspnetcore.tar //当然也可以把容器保存为tar包)
文档引用:
http://www.cnblogs.com/lori/p/7543886.html
1、如果您觉得阅读本文对您有帮助,请点一下“推荐”按钮,您的“推荐”将是我最大的写作动力!
2、欢迎各位转载,但是未经作者本人同意,转载文章请在文章页面明显位置标明作者和原文连接,否则保留追究法律责任的权利。
作者博客: http://www.cnblogs.com/xmai/