search

Home  >  Q&A  >  body text

docker - 一个container下面可否映射多个端口到Host

Docker下在一个container下面可否映射多个端口到Host

迷茫迷茫2774 days ago822

reply all(2)I'll reply

  • 黄舟

    黄舟2017-04-21 10:57:47

    Of course it is possible, buddy, you can read the document carefully. There are instructions in the document. If the option format of a parameter is [], such as
    -H=[]host
    -p=[]portdirection
    This means that this flag can appear multiple times, so the port mapping rule can be specified multiple times here.

    In addition, this can be implemented using EXPOSE in the Dockerfile. Of course, it can also be specified multiple times.

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-21 10:57:47

    Yes, for example: docker run -d -p 80:80 -p 22:22
    Map 80 and 22 to host respectively

    reply
    0
  • Cancelreply