mrbruce516
V2EX  ›  Docker

如何给 docker 容器添加 hosts?

  •  
  •   mrbruce516 ·
    mrbruce516 · Oct 19, 2019 · 6481 views
    This topic created in 2413 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   ·   2660 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 15:43 · PVG 23:43 · LAX 08:43 · JFK 11:43
    ♥ Do have faith in what you're doing.