zoukankan      html  css  js  c++  java
  • docker~aspnetcore2.0镜像安装软件的加速器

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

    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

    然后我们对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"]

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

    当然,你也可以不添加这个文件,而直接把文本覆盖到原来的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"]

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

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

  • 相关阅读:
    [bbk5177]第62集第6章 用scheduler自动化 10(章节标题内容调整)
    [bbk4956]第65集 第7章 数据库的维护 02
    [bbk4940]第61集第6章 用scheduler自动化 09
    [bbk5179]第66集 第7章 数据库的维护 03
    ORA01031: insufficient privileges(有待于二次解决)
    Google Analytics功能篇 如何跟踪邮件打开率与点击率
    小资之豆浆篇 (IS2120@BG57IV3)
    wix custom action 之 vbscript 简明步骤(IS2120@BG57IV3)
    c++ faq (15)
    linux 下面字符串处理函数实现 抄来看一下 抄自[http://blog.csdn.net/BeWithLei/article/details/1719242]
  • 原文地址:https://www.cnblogs.com/lori/p/7592554.html
Copyright © 2011-2022 走看看