問題:docker
.net core 3.0 使用 mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim 做爲基礎鏡像,在開發中用到了繪圖的功能,跑起來發現缺乏 libgdiplus網絡
解決方案:ui
參考:https://q.cnblogs.com/q/109061/.net
只須要在容器中安裝 libgdiplus libc6-dev 便可成功。blog
思考:ip
一個項目中用到直接解決便可,當多個項目中用到每次都去安裝那真是要崩潰...有什麼解決方案呢?開發
解決:get
本身作一個帶gdi+的基礎鏡像不就行了,dockerfile 也很簡單:dockerfile
******************************Dockerfile**********************************it
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim
RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free \
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free \
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free \
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free \
" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y --no-install-recommends libgdiplus libc6-dev
******************************Dockerfile**********************************
第二行是添加清華大學的源,用官方源人品就是success,人品很差就是 Unable to locate package xxx(開玩笑,網絡實在是...)
docker build -t mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-gdi .
完美,須要繪圖的就基於這個鏡像就能夠了。