Docker change published ports on live container

后端 未结 2 1668
有刺的猬
有刺的猬 2021-01-05 09:57

I\'d like to change the published ports on a live container for example

docker run -p 80:80 --name nginx_live nginx

And then later on, chan

2条回答
  •  执念已碎
    2021-01-05 10:20

    That's not a Docker feature.

    But it's easy to add another layer of indirection: expose one container-port on your host and then run an instance of nginx or a firewall FORWARD rule that maps whatever local ports you want onto that docker-shared port.

提交回复
热议问题