Skip to content

Add error checking for hostPort range#30103

Merged
cpuguy83 merged 1 commit intomoby:masterfrom
tabboud:29961-add-error-checking
Jan 14, 2017
Merged

Add error checking for hostPort range#30103
cpuguy83 merged 1 commit intomoby:masterfrom
tabboud:29961-add-error-checking

Conversation

@tabboud
Copy link
Copy Markdown
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>
@tabboud tabboud force-pushed the 29961-add-error-checking branch from 113d001 to 135f8f9 Compare January 13, 2017 23:06
@aaronlehmann
Copy link
Copy Markdown

LGTM

ping @dnephin

Copy link
Copy Markdown
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