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

service update --publish-rm unable to remove pair of ports #1396

Open
sheerun opened this issue Aug 18, 2016 · 8 comments
Open

service update --publish-rm unable to remove pair of ports #1396

sheerun opened this issue Aug 18, 2016 · 8 comments

Comments

@sheerun
Copy link

sheerun commented Aug 18, 2016

--publish-rm 82:80 fails when I published before with the same port pair. Full commands are:

docker service update --publish-add 80:80 root_nginx
docker service update --publish-add 81:80 root_nginx
docker service update --publish-rm 81:80 root_nginx

I'd expect that only 80:80 is left, but the only thing that works is --publish-rm 80 but that removes both bindings instead of only one. Probably removing only single binding pair is not implemented.

@aaronlehmann
Copy link
Collaborator

ping @yongtang

@dperny
Copy link
Collaborator

dperny commented Aug 18, 2016

From #1348

@dperny
Copy link
Collaborator

dperny commented Aug 18, 2016

Tested and verified this is a problem. Also worth noting is that --publish-rm 81 does not remove any ports.

@yongtang
Copy link
Member

yongtang commented Aug 18, 2016

@sheerun That is "expected" behavior of the current --publish-rm. Currently, the usage of --publish-rm is

--publish-rm <TargetPort>[/Protocol]

It will remove any mappings that matches <TargetPort> (not taking <PublishedPort> or <Protocol> into consideration). And unfortunately, it will not report any error if you pass an incorrect format.

So the --publish-rm 81:80 will not take effect. And --publish-rm 80 will remove both.

The current --publish-rm definitely could be improved. Though I think it makes sense to decide what the expected behavior would be. For example:

  • Should we error out if --publish-rm takes an incorrect <TargetPort> (e.g., 80:80)
  • Or when user specify 80:80, we match both TargetPort and PublishedPort.
  • We haven't take <Protocol> (udp or tcp) into the consideration, should we allow user to specify <Protocol> as well.

See processing of --publish-rm:
https://github.com/docker/docker/blob/37302bbb3f4889e9de2a95d5ea018acdab9e4447/api/client/service/update.go#L420-L429

I can work on improving the --publish-rm but may want some guidance on the above listed items.

@yongtang
Copy link
Member

Also see some other discussions on --publish-rm:
moby/moby#25200 (comment)
moby/moby#25338 (comment)

@yongtang
Copy link
Member

@sheerun @aaronlehmann @dperny It looks like --publish-rm already allows the user to specify a protocol, so both --publish-rm 80 and --publish-rm 80/tcp are valid.

However, --publish-rm 80:80 is still not valid and will silently ignore the incorrectly provided format.

I created a pull request moby/moby#25860 to return an error if the invalid format (like --publish-rm 80:80) is provided.

Please take a look and let me know if there are any issues, or if there are better ways to handle it.

@tiborvass
Copy link

@thaJeztah and I think it makes sense to be able to have --publish-rm 81:80/udp remove only the 81:80/udp port binding.

@tianon
Copy link
Member

tianon commented Dec 1, 2016

+1; can confirm that the first time I tried to use --publish-rm, I gave it the same format as --publish-add and was quite surprised to see that it didn't actually do anything (despite telling me it was successful) and I had to figure out which port it was actually wanting me to specify in order to remove the mapping

yongtang added a commit to yongtang/docker that referenced this issue Dec 2, 2016
…TargetPort>`

Currently `--publish-rm` only accepts `<TargetPort>` or `<TargetPort>[/Protocol]`
though there are some confusions.

Since `--publish-add` accepts `<PublishedPort>:<TargetPort>[/Protocol]`, some user
may provide `--publish-rm 80:80`. However, there is no error checking so the incorrect
provided argument is ignored silently.

This fix adds the check to make sure `--publish-rm` only accepts `<TargetPort>[/Protocol]`
and returns error if the format is invalid.

The `--publish-rm` itself may needs to be revisited to have a better UI/UX experience,
see discussions on:
moby/swarmkit#1396
moby#25200 (comment)
moby#25338 (comment)

This fix is short term measure so that end users are not misled by the silently ignored error
of `--publish-rm`.

This fix is related to (but is not a complete fix):
moby/swarmkit#1396

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
xianlubird pushed a commit to xianlubird/docker that referenced this issue Dec 23, 2016
…TargetPort>`

Currently `--publish-rm` only accepts `<TargetPort>` or `<TargetPort>[/Protocol]`
though there are some confusions.

Since `--publish-add` accepts `<PublishedPort>:<TargetPort>[/Protocol]`, some user
may provide `--publish-rm 80:80`. However, there is no error checking so the incorrect
provided argument is ignored silently.

This fix adds the check to make sure `--publish-rm` only accepts `<TargetPort>[/Protocol]`
and returns error if the format is invalid.

The `--publish-rm` itself may needs to be revisited to have a better UI/UX experience,
see discussions on:
moby/swarmkit#1396
moby#25200 (comment)
moby#25338 (comment)

This fix is short term measure so that end users are not misled by the silently ignored error
of `--publish-rm`.

This fix is related to (but is not a complete fix):
moby/swarmkit#1396

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
vdemeester pushed a commit to vdemeester/docker-cli that referenced this issue May 15, 2017
…TargetPort>`

Currently `--publish-rm` only accepts `<TargetPort>` or `<TargetPort>[/Protocol]`
though there are some confusions.

Since `--publish-add` accepts `<PublishedPort>:<TargetPort>[/Protocol]`, some user
may provide `--publish-rm 80:80`. However, there is no error checking so the incorrect
provided argument is ignored silently.

This fix adds the check to make sure `--publish-rm` only accepts `<TargetPort>[/Protocol]`
and returns error if the format is invalid.

The `--publish-rm` itself may needs to be revisited to have a better UI/UX experience,
see discussions on:
moby/swarmkit#1396
moby/moby#25200 (comment)
moby/moby#25338 (comment)

This fix is short term measure so that end users are not misled by the silently ignored error
of `--publish-rm`.

This fix is related to (but is not a complete fix):
moby/swarmkit#1396

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
andrewhsu pushed a commit to docker-archive/docker-ce that referenced this issue May 19, 2017
…TargetPort>`

Currently `--publish-rm` only accepts `<TargetPort>` or `<TargetPort>[/Protocol]`
though there are some confusions.

Since `--publish-add` accepts `<PublishedPort>:<TargetPort>[/Protocol]`, some user
may provide `--publish-rm 80:80`. However, there is no error checking so the incorrect
provided argument is ignored silently.

This fix adds the check to make sure `--publish-rm` only accepts `<TargetPort>[/Protocol]`
and returns error if the format is invalid.

The `--publish-rm` itself may needs to be revisited to have a better UI/UX experience,
see discussions on:
moby/swarmkit#1396
moby/moby#25200 (comment)
moby/moby#25338 (comment)

This fix is short term measure so that end users are not misled by the silently ignored error
of `--publish-rm`.

This fix is related to (but is not a complete fix):
moby/swarmkit#1396

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 8597e231a5caa23247934f7a89c1001d87e26192
Component: cli
andrewhsu pushed a commit to docker-archive/docker-ce that referenced this issue May 19, 2017
…TargetPort>`

Currently `--publish-rm` only accepts `<TargetPort>` or `<TargetPort>[/Protocol]`
though there are some confusions.

Since `--publish-add` accepts `<PublishedPort>:<TargetPort>[/Protocol]`, some user
may provide `--publish-rm 80:80`. However, there is no error checking so the incorrect
provided argument is ignored silently.

This fix adds the check to make sure `--publish-rm` only accepts `<TargetPort>[/Protocol]`
and returns error if the format is invalid.

The `--publish-rm` itself may needs to be revisited to have a better UI/UX experience,
see discussions on:
moby/swarmkit#1396
moby/moby#25200 (comment)
moby/moby#25338 (comment)

This fix is short term measure so that end users are not misled by the silently ignored error
of `--publish-rm`.

This fix is related to (but is not a complete fix):
moby/swarmkit#1396

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 1b400f6284b17fffa0495e1c801155fdd0716e98
Component: cli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants