-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Support --group
in docker service create
#25317
Support --group
in docker service create
#25317
Conversation
c4f2817
to
bbb9d4c
Compare
Can you rename this to |
bbb9d4c
to
fce2de3
Compare
Thanks @thaJeztah. The pull request has been updated. Please let me know if there are any issues. |
@@ -491,6 +493,7 @@ func addServiceFlags(cmd *cobra.Command, opts *serviceOptions) { | |||
|
|||
flags.StringVarP(&opts.workdir, flagWorkdir, "w", "", "Working directory inside the container") | |||
flags.StringVarP(&opts.user, flagUser, "u", "", "Username or UID (format: <name|uid>[:<group|gid>])") | |||
flags.StringSliceVarP(&opts.group, flagGroupAdd, "g", []string{}, "User group or GID") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-1 on the -g
.
Could use some extra description. "Add additional groups to the container"
c83581e
to
9a113ee
Compare
LGTM 🐸 |
@@ -211,6 +212,15 @@ func updateService(flags *pflag.FlagSet, spec *swarm.ServiceSpec) error { | |||
spec.EndpointSpec.Mode = swarm.ResolutionMode(value) | |||
} | |||
|
|||
if anyChanged(flags, flagGroupAdd, flagGroupRemove) { | |||
if spec.EndpointSpec == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to mess with EndpointSpec
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cpuguy83 Sorry my bad. Didn't pay attention. Let me update the pull request.
9a113ee
to
3af251f
Compare
Thanks @cpuguy83. The pull request has been updated. Please let me know if there are any issues. |
LGTM |
moved to docs review |
Thanks @cpuguy83. The docs has been updated for |
Thanks @yongtang |
880e2a4
to
0e680bb
Compare
Thanks @cpuguy83. The pull request has been updated. |
ping @vdemeester |
@@ -39,6 +39,7 @@ func newUpdateCommand(dockerCli *client.DockerCli) *cobra.Command { | |||
addServiceFlags(cmd, opts) | |||
|
|||
flags.Var(newListOptsVar(), flagEnvRemove, "Remove an environment variable") | |||
flags.Var(newListOptsVar(), flagGroupRemove, "Remove additional user groups from the container") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Remove previously added user groups from the container"?
Not sure how to say this one... just a suggestion. Both sound weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @cpuguy83. The pull request has been updated with the help output "Remove previously added user groups from the container"
for now. Let me know if there are other suggestions.
This fix tries to address the issue raised in 25304 to support `--group-add` and `--group-rm` in `docker service create`. This fix adds `--group-add` to `docker service create` and `docker service update`, adds `--group-rm` to `docker service update`. This fix updates docs for `docker service create` and `docker service update`: 1. Add `--group-add` to `docker service create` and `docker service update` 2. Add `--group-rm` to `docker service update` Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
0e680bb
to
b31969e
Compare
docs LGTM 🐯 |
LGTM |
Pull request moby#27745 added support for the client to talk to older versions of the daemon. Various flags were added to docker 1.13 that are not compatible with older daemons. This PR adds annotations to those flags, so that they are automatically hidden if the daemon is older than docker 1.13 (API 1.25). Not all new flags affect the API (some are client-side only). The following PR's added new flags to docker 1.13 that affect the API; - moby#23430 added `--cpu-rt-period`and `--cpu-rt-runtime` - moby#27800 / moby#25317 added `--group` / `--group-add` / `--group-rm` - moby#27702 added `--network` to `docker build` - moby#25962 added `--attachable` to `docker network create` - moby#27998 added `--compose-file` to `docker stack deploy` - moby#22566 added `--stop-timeout` to `docker run` and `docker create` - moby#26061 added `--init` to `docker run` and `docker create` - moby#26941 added `--init-path` to `docker run` and `docker create` - moby#27958 added `--cpus` on `docker run` / `docker create` - moby#27567 added `--dns`, `--dns-opt`, and `--dns-search` to `docker service create` - moby#27596 added `--force` to `docker service update` - moby#27857 added `--hostname` to `docker service create` - moby#28031 added `--hosts`, `--host-add` / `--host-rm` to `docker service create` and `docker service update` - moby#28076 added `--tty` on `docker service create` / `docker service update` - moby#26421 added `--update-max-failure-ratio`, `--update-monitor` and `--rollback` on `docker service update` - moby#27369 added `--health-cmd`, `--health-interval`, `--health-retries`, `--health-timeout` and `--no-healthcheck` options to `docker service create` and `docker service update` Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Pull request moby/moby#27745 added support for the client to talk to older versions of the daemon. Various flags were added to docker 1.13 that are not compatible with older daemons. This PR adds annotations to those flags, so that they are automatically hidden if the daemon is older than docker 1.13 (API 1.25). Not all new flags affect the API (some are client-side only). The following PR's added new flags to docker 1.13 that affect the API; - moby/moby#23430 added `--cpu-rt-period`and `--cpu-rt-runtime` - moby/moby#27800 / moby/moby#25317 added `--group` / `--group-add` / `--group-rm` - moby/moby#27702 added `--network` to `docker build` - moby/moby#25962 added `--attachable` to `docker network create` - moby/moby#27998 added `--compose-file` to `docker stack deploy` - moby/moby#22566 added `--stop-timeout` to `docker run` and `docker create` - moby/moby#26061 added `--init` to `docker run` and `docker create` - moby/moby#26941 added `--init-path` to `docker run` and `docker create` - moby/moby#27958 added `--cpus` on `docker run` / `docker create` - moby/moby#27567 added `--dns`, `--dns-opt`, and `--dns-search` to `docker service create` - moby/moby#27596 added `--force` to `docker service update` - moby/moby#27857 added `--hostname` to `docker service create` - moby/moby#28031 added `--hosts`, `--host-add` / `--host-rm` to `docker service create` and `docker service update` - moby/moby#28076 added `--tty` on `docker service create` / `docker service update` - moby/moby#26421 added `--update-max-failure-ratio`, `--update-monitor` and `--rollback` on `docker service update` - moby/moby#27369 added `--health-cmd`, `--health-interval`, `--health-retries`, `--health-timeout` and `--no-healthcheck` options to `docker service create` and `docker service update` Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Upstream-commit: 5d2722f83db9e301c6dcbe1c562c2051a52905db Component: cli
- What I did
This fix tries to address the issue raised in #25304 to support
--group
indocker service create
.- How I did it
This fix adds
--group
todocker service create
, and addsGroup []string
to ContainerSpec in engine-api and swarmkit for the needed changes.The
Config
andHostConfig
in container remain the same formats. The groups are appended toHostConfig.GroupAdd
if needed.- How to verify it
An additional integration test has bee added.
- Description for the changelog
Support
--group
indocker service create
- A picture of a cute animal (not mandatory but encouraged)
This fix fixes #25304.
NOTE: PRs for engine-api and swarmkit will be opened separately
Signed-off-by: Yong Tang yong.tang.github@outlook.com