Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port ranges #1827

Merged
merged 4 commits into from
Aug 12, 2015
Merged

Port ranges #1827

merged 4 commits into from
Aug 12, 2015

Conversation

mnowster
Copy link

@mnowster mnowster commented Aug 7, 2015

Add port range support to docker compose.

Allows us to remove our split_port function and use docker-py's split_port function.

yuval-k and others added 4 commits August 7, 2015 16:22
Signed-off-by: Yuval Kohavi <yuval.kohavi@gmail.com>
Signed-off-by: Yuval Kohavi <yuval.kohavi@gmail.com>
Signed-off-by: Yuval Kohavi <yuval.kohavi@gmail.com>
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
@mnowster mnowster added this to the 1.5.0 milestone Aug 7, 2015
@aanand
Copy link

aanand commented Aug 12, 2015

LGTM.

@uvgroovy @mnowster: Thanks team!

aanand added a commit that referenced this pull request Aug 12, 2015
@aanand aanand merged commit ed31673 into docker:master Aug 12, 2015
@mnowster
Copy link
Author

Yay! Yes, thank you @uvgroovy for your helpful contribution ✨

@mnowster mnowster deleted the port-ranges branch August 12, 2015 15:07
@dnephin dnephin mentioned this pull request Sep 4, 2015
@tequilaskywalk
Copy link

tequilaskywalk commented Jun 23, 2016

why is this missing in 1.8.0-rc1 (build 9bf6bc9 )?

OSX: Native Docker Version 1.12.0-rc2-beta16 (build: 9493)
f615be9fb245904fbdf1aa0cad251d418c869428

Edit: I am experiencing the issue when defining port ranges like so:

docker-compose.yml snippet

version: "2"
services:
serviceA:
ports:
- "5000-6000:5000-6000"

@aanand
Copy link

aanand commented Jun 29, 2016

@tequilaskywalk This has been in Compose for several versions now. I just tried your example on Docker for Mac and it crashed the VM. My guess would be that simultaneously binding 1001 ports puts a bit of a strain on it.

@ellioseven
Copy link

This still seems to be an issue for me? Am I

[example] cat docker-compose.yml                                                                                                                                                                                    
# PHP Web Server
web:
  # Build the Drupal 8 image
  # https://hub.docker.com/r/_/drupal/
  image: drupal:8
  # Environment variables
  environment:
    # Drupal settings
    DRUPAL_PROFILE: standard
    DRUPAL_SITE_NAME: Drupal
    DRUPAL_USER: admin
    DRUPAL_PASS: admin
    DRUPAL_DBURL: mysql://drupal:drupal@database:3406/drupal
  ports:
    # Host machine's port 8000 will map to Drupal's port 80
    - "8000-8100:80"
  volumes:
    # Drupal should live in the "drupal" directory
    - ./drupal:/app
  links:
    - database:database
  command: php -S 0.0.0.0:80 -t /app
  working_dir: /app
  restart: always

# MySQL Server
database:
  image: mysql:5
  environment:
    MYSQL_USER: drupal
    MYSQL_PASSWORD: drupal
    MYSQL_DATABASE: drupal
    MYSQL_ROOT_PASSWORD: ''
    MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
  ports:
    - "3306-3406:3306"
  volumes:
    - ./mysql:/var/lib/mysql
  restart: always
[example] docker-compose up                                                                                                                                                                                         
ERROR: The Compose file './docker-compose.yml' is invalid because:
database.ports is invalid: Port ranges don't match in length
web.ports is invalid: Port ranges don't match in length
[example] docker-compose --version                                                                                                                                                                                  
docker-compose version 1.7.1, build 0a9ab35
[example] docker --version                                                                                                                                                                                          
Docker version 1.11.2, build b9f10c9

@aanand
Copy link

aanand commented Jul 20, 2016

@ellioseven We don't yet support mapping a range on the host to a single container port. This is tracked in #3150.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants