How can I expose more than 1 port with Docker?

前端 未结 4 1412
逝去的感伤
逝去的感伤 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 17:58

    if you use docker-compose.ymlfile:

    services:
        varnish:
            ports:
                - 80
                - 6081
    

    You can also specify the host/network port as HOST/NETWORK_PORT:CONTAINER_PORT

    varnish:
        ports:
            - 81:80
            - 6081:6081
    

提交回复
热议问题