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

Add error checking for hostPort range #30103

Merged
merged 1 commit into from
Jan 14, 2017

Conversation

tabboud
Copy link
Contributor

@tabboud tabboud commented Jan 12, 2017

fixes #29961

Signed-off-by: Tony Abboud tdabboud@hotmail.com

- What I did
Add error handling for the case where there is a single container port
and a dynamic host port
Example docker-compose.yml snippet:
port:
ports:
- "8091-8093:8091"
- "80:8080"

- How I did it
Checked the return error from strconv.ParseUint() and handled the error if the given hostPort is not an empty string, which means that the hostPort is either a range or an invalid number

- How to verify it

- Description for the changelog

Add error handling for hostPorts when converting a Port to a PortConfig

- A picture of a cute animal (not mandatory but encouraged)

This fix catches the case where there is a single container port
and a dynamic host port and will fail out gracefully
Example docker-compose.yml snippet:
    port:
        ports:
            - "8091-8093:8091"
            - "80:8080"

Signed-off-by: Tony Abboud <tdabboud@hotmail.com>
@aaronlehmann
Copy link
Contributor

LGTM

ping @dnephin

Copy link
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cpuguy83 cpuguy83 merged commit 78db637 into moby:master Jan 14, 2017
@GordonTheTurtle GordonTheTurtle added this to the 1.14.0 milestone Jan 14, 2017
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.

docker stack deploy assumes HostPort is an integer
4 participants