2019亚洲杯docker~aspnetcore2.0镜子像安装软件之加速器。docker~aspnetcore2.0镜子像安装软件的加速器。

相似对于安装软件加速时,我们大部分会择阿里云,而于aspnetcore2.0者收入来说,由于应用的是Debian操作系统,所有我们要找到它们对应的mirror列表,下面是自己整理的一个sources.list加速列表,我们管其坐落同Dockerfile相同之职,在Dockerfile生成镜像经常把它复制到内部去,替换之前的apt-update地址源即可。

貌似对安装软件加速时,我们大部分会见挑选阿里云,而对此aspnetcore2.0这收益来说,由于采用的凡Debian操作系统,所有我们设找到她对应之mirror列表,下面是本身整的一个sources.list加速列表,我们拿它们位于和Dockerfile相同的职位,在Dockerfile生成镜像时将她复制到中间去,替换之前的apt-update地址源即可。

source.list内容

source.list内容

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
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

接下来我们对Dockerfile进行部分改动,在生成镜像时拿她复制到镜像里

接下来我们对Dockerfile进行部分修改,在生成镜像经常拿她复制到镜像里

FROM microsoft/aspnetcore:2.0
ARG source
COPY sources.list /etc/apt/sources.list
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
RUN apt-get update && apt-get -y install libgdiplus
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "SMS.dll"]
FROM microsoft/aspnetcore:2.0
ARG source
COPY sources.list /etc/apt/sources.list
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
RUN apt-get update && apt-get -y install libgdiplus
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "SMS.dll"]

接下来我们重失去生成镜像,就会非常特别快了!

接下来我们再度夺生成镜像,就会格外很急匆匆了!

自,你为堪无弥加是文件,而直白把文件覆盖到原来的source.list文件里

当然,你吧足以免上加是文件,而一直将文件覆盖到原的source.list文件里

FROM microsoft/aspnetcore:2.0
ARG source

RUN 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.list

RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
RUN apt-get update &&  apt-get install libgdiplus -y
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "Pilipa.SMS.dll"]
FROM microsoft/aspnetcore:2.0
ARG source

RUN 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.list

RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
RUN apt-get update &&  apt-get install libgdiplus -y
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "Pilipa.SMS.dll"]

面的做法呢是完全没问题之!

地方的做法也是全没问题的!

公而在阿里云服务器上,那即便是内网对内网,更快!

而如果在阿里云服务器上,那便是内网对内网,更快!

相关文章