Home  >  Q&A  >  body text

怎么修改docker配置

已存在的容器,原来端口-p 80:66 要怎么操作才能把端口改成 -p 80:77,就是把映射从66改到77?必须要重新建一个容器吗?

世界只因有你世界只因有你2757 days ago730

reply all(2)I'll reply

  • 世界只因有你

    世界只因有你2017-04-25 09:05:39

    You shouldn’t be able to change the port now. You can look at the docker update option

    reply
    0
  • 某草草

    某草草2017-04-25 09:05:39

    After checking the information, it seems that it is currently not possible to directly modify the port expose on the original container, and the docker update command does not support it. This demand is very loud.

    Submitting the current container into an image and then running it from the new image is also a compromise.

    --- update

    Modify Dockerfile 里的 expose and then build it again.

    If you don’t want to rebuild the container, you can expose it in docker run 使用 --expose 参数指定,相当于覆盖 Dockerfile.

    reply
    0
  • Cancelreply