PR #4649 says that it fixes #4378, which is the usage of port range in docker-compose.
But it does not work (or I'm missing something).
I've made a very simple docker-compose to test it
version: '3.3'
services:
nginx:
image: nginx
ports:
- 4200-4500:80
with docker-compose version : 1.17.0dev (same result with 1.16.1)
and docker : 17.06.0-ce
I've checked the source code, and it seems that there is no test for this use case.
The docker-compose.yml in the test/fixtures/ports-composefile miss an case with port range.
I've managed to make it work if I checkout before 36af86b9b2c5a1f00bd0e566a21184e956012074
The integer conversion doesn't seems to manage port range.
Thank you for the report, we'll look into it!
The same problem:
version: '3.3'
services:
server:
ports:
- 8080-8081:8080
$ docker-compose -v
docker-compose version 1.17.1, build 6d101fb
ERROR: Invalid published port: 8080-8081
+1, I got some problem. We can't scale same app which is have same port in containers
Since assigning port range is not working
ports:
- 9092-9100:9092
you can meanwhile use multiple kafka services until the issue is fixed like so
kafka_1:
image: wurstmeister/kafka
ports:
- 9092:9092
hostname: kafka
environment:
- KAFKA_ADVERTISED_HOST_NAME=kafka
- KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
- KAFKA_ADVERTISED_PORT=9092
- JMX_PORT=9998
links:
- zookeeper
depends_on:
- zookeeper
volumes:
- /var/run/docker.sock:/var/run/docker.sock
kafka_2:
image: wurstmeister/kafka
ports:
- 9093:9092
hostname: kafka
environment:
- KAFKA_ADVERTISED_HOST_NAME=kafka
- KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
- KAFKA_ADVERTISED_PORT=9093
- JMX_PORT=9999
links:
- zookeeper
depends_on:
- zookeeper
volumes:
- /var/run/docker.sock:/var/run/docker.sock
Most helpful comment
The same problem: