search

Home  >  Q&A  >  body text

docker run -p xx1:xx2指定端口映射,进容器后,再启动里面的网络程序可以么?

-p后面直接带网络程序,不大灵活啊。
ps -p可以同时开放很多个网络端口么?

仅有的幸福仅有的幸福2818 days ago744

reply all(3)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-04-26 09:03:05

    It’s okay, but don’t do it. If you have multiple programs, you should open multiple containers. This is the correct posture of docker

    Recommended to use docker-compose

    reply
    0
  • 漂亮男人

    漂亮男人2017-04-26 09:03:05

    Yes.
    For example, if you use docker to run a nodejs program, the program listens to two ports, such as80803443, 你就需要-p 8080:8080 -p 3443:3443

    reply
    0
  • ringa_lee

    ringa_lee2017-04-26 09:03:05

    Docker recommends that a container should only run one service

    reply
    0
  • Cancelreply