oldcai
0.01D

怎样加速 Docker 镜像构建时间,从几分钟降低到几秒?

  •  
  •   oldcai ·
    PRO
    · Jul 30, 2019 · 9604 views
    This topic created in 2500 days ago, the information mentioned may be changed or developed.
    3 replies    2020-11-11 21:10:57 +08:00
    tx0
        1
    tx0  
       Aug 7, 2019
    你的问题需要详细点,否则没法笼统地回答;比如说你可以在 gist 上 share 一个 Dockerfile 吗?一个有 100 行的 Dockerfile 与只有 10 行的 Dockerfile 是显然不同的构建时间

    笼统地回答也可以: 1) 2) 使用更简单的 base image, 能用 scratch 的不要上 alpine, 能用 alpine 的不要用其它 distro; 3) 简化 Dockerfile , 多用 buildcache; (我的生产环境大多能控制在 20s 以内)
    fx
        2
    fx  
       Oct 30, 2019
    加 cpu
    ga6840
        3
    ga6840  
       Nov 11, 2020
    把 COPY directive 都放到末尾,然后启用 cache.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3089 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 15:00 · PVG 23:00 · LAX 08:00 · JFK 11:00
    ♥ Do have faith in what you're doing.