【发布时间】:2019-06-21 01:54:38
【问题描述】:
我的问题是关于在ENV 变量示例中在一行中公开多个端口,并且这些端口不是连续的,来自主机的相同端口在容器上将是相同的。
PORTS=80
PORTS=80,443
PORTS=80 443
并在docker-compose 中公开它们。
根据docs,你可以做到。
ports:
- "3000"
- "3000-3005"
- "8000:8000"
- "9090-9091:8080-8081"
- "49100:22"
- "127.0.0.1:8001:8001"
- "127.0.0.1:5000-5010:5000-5010"
- "6060:6060/udp"
但我想用另一种可变的方式来做
ports:
- ${PORTS}:${PORTS}
#Sometimes this will be
ports:
- 80:80
#Other times this will be
ports:
- 80,443:80,443 # Is this possible?
ports:
- 80-443:80-443 # Don't want this because will export all the ports between
ports:
- 80 443:80 443 # I think this is wrong syntax
任何线索或任何其他想法?
【问题讨论】:
标签: docker nginx docker-compose