aocif23
V2EX  ›  Docker

看别人写的 Dockerfile 文件,"from...as..."有什么作用?

  •  
  •   aocif23 · Aug 18, 2018 · 8323 views
    This topic created in 2851 days ago, the information mentioned may be changed or developed.
    FROM ubuntu:16.04 as stage-1
    foo
    FROM stage-1 as stage-2
    foo
    FROM stage-2 as stage-final
    foo
    

    请问用 from...as 这样分开有什么用意的(为了清晰一点?)我一般直接用 from

    另外问一下,如果要安装某个软件,是不是尽量写在 sh 脚本里,再在 docker 里运行脚本 (让 Dockerfile 文件好读一点)

    1 replies    2018-08-18 15:55:43 +08:00
    vvoody
        1
    vvoody  
       Aug 18, 2018
    multi-stages builds
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1064 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 22:42 · PVG 06:42 · LAX 15:42 · JFK 18:42
    ♥ Do have faith in what you're doing.