您的位置:首页 > 运维架构 > Docker

docker之使用System.Drawing生成图片缺少Gdiplus.dll错误

2017-10-30 17:07 357 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: