compose icon indicating copy to clipboard operation
compose copied to clipboard

Port range like 8000-8010:80

Open guilbill opened this issue 9 years ago • 5 comments

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.

guilbill avatar Oct 02 '17 12:10 guilbill

I've managed to make it work if I checkout before 36af86b9b2c5a1f00bd0e566a21184e956012074 The integer conversion doesn't seems to manage port range.

guilbill avatar Oct 02 '17 12:10 guilbill

Thank you for the report, we'll look into it!

shin- avatar Oct 04 '17 18:10 shin-

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

nbulaj avatar Nov 14 '17 10:11 nbulaj

+1, I got some problem. We can't scale same app which is have same port in containers

btungut avatar Nov 30 '17 12:11 btungut

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

cybersupernova avatar Mar 25 '18 13:03 cybersupernova