How can I expose more than 1 port with Docker?

前端 未结 4 1403
逝去的感伤
逝去的感伤 2020-11-28 17:04

So I have 3 ports that should be exposed to the machine\'s interface. Is it possible to do this with a Docker container?

4条回答
  •  一向
    一向 (楼主)
    2020-11-28 18:04

    If you are creating a container from an image and like to expose multiple ports (not publish) you can use the following command:

    docker create --name `container name` --expose 7000 --expose 7001 `image name`
    

    Now, when you start this container using the docker start command, the configured ports above will be exposed.

提交回复
热议问题