分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 前端开发

docker~aspnetcore2.0镜像安装软件的加速器

发布时间:2023-09-06 01:13责任编辑:赖小花关键词:暂无标签

一般对于安装软件加速时,我们大多数会选择阿里云,而对于aspnetcore2.0这个进项来说,由于使用的是Debian操作系统,所有我们要找到它对应的mirror列表,下面是我整理的一个sources.list加速列表,我们把它放在和Dockerfile相同的位置,在Dockerfile生成镜像时把它复制到里面去,替换之前的apt-update地址源即可。

source.list内容

deb http://mirrors.aliyun.com/debian wheezy main contrib non-freedeb-src http://mirrors.aliyun.com/debian wheezy main contrib non-freedeb http://mirrors.aliyun.com/debian wheezy-updates main contrib non-freedeb-src http://mirrors.aliyun.com/debian wheezy-updates main contrib non-freedeb http://mirrors.aliyun.com/debian-security wheezy/updates main contrib non-freedeb-src http://mirrors.aliyun.com/debian-security wheezy/updates main contrib non-free

然后我们对Dockerfile进行一些修改,在生成镜像时把它复制到镜像里

FROM microsoft/aspnetcore:2.0ARG sourceCOPY sources.list /etc/apt/sources.listRUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo ‘Asia/Shanghai‘ >/etc/timezoneRUN apt-get update && apt-get -y install libgdiplusWORKDIR /appEXPOSE 80COPY ${source:-obj/Docker/publish} .ENTRYPOINT ["dotnet", "SMS.dll"]

然后我们再去生成镜像,就会非常非常快了!

当然,你也可以不添加这个文件,而直接把文本覆盖到原来的source.list文件里

FROM microsoft/aspnetcore:2.0ARG sourceRUN echo "deb http://mirrors.aliyun.com/debian wheezy main contrib non-free \deb-src http://mirrors.aliyun.com/debian wheezy main contrib non-free \deb http://mirrors.aliyun.com/debian wheezy-updates main contrib non-free \deb-src http://mirrors.aliyun.com/debian wheezy-updates main contrib non-free \deb http://mirrors.aliyun.com/debian-security wheezy/updates main contrib non-free \deb-src http://mirrors.aliyun.com/debian-security wheezy/updates main contrib non-free" > /etc/apt/sources.listRUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo ‘Asia/Shanghai‘ >/etc/timezoneRUN apt-get update && ?apt-get install libgdiplus -yWORKDIR /appEXPOSE 80COPY ${source:-obj/Docker/publish} .ENTRYPOINT ["dotnet", "Pilipa.SMS.dll"]

上面的做法也是完全没有问题的!

你要是在阿里云服务器上,那就是内网对内网,更快!

docker~aspnetcore2.0镜像安装软件的加速器

原文地址:http://www.cnblogs.com/lori/p/7592554.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved