mrbruce516
V2EX  ›  Docker

如何给 docker 容器添加 hosts?

  •  
  •   mrbruce516 ·
    mrbruce516 · Oct 19, 2019 · 6503 views
    This topic created in 2426 days ago, the information mentioned may be changed or developed.

    情况描述: 需要自动化部署的缘故,所以不用--add-hosts 这种方案 需要使用 dockerfile dockerfile 内我写了一条 RUN echo '127.0.0.1 abc.com' > /etc/hosts 但是拉起容器后 进到容器内部 cat etc/hosts 无此自定义的 host 请问该如何解决

    2 replies    2019-10-31 07:19:07 +08:00
    XSG
        1
    XSG  
       Oct 25, 2019
    --add-host
    coreos
        2
    coreos  
       Oct 31, 2019
    我是写在启动 sh 里面,并不是 run
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3195 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 55ms · UTC 11:35 · PVG 19:35 · LAX 04:35 · JFK 07:35
    ♥ Do have faith in what you're doing.