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

Support --group in docker service create #25317

Merged
merged 1 commit into from
Aug 29, 2016

Conversation

yongtang
Copy link
Member

@yongtang yongtang commented Aug 2, 2016

- What I did

This fix tries to address the issue raised in #25304 to support --group in docker service create.

- How I did it

This fix adds --group to docker service create, and adds Group []string to ContainerSpec in engine-api and swarmkit for the needed changes.

The Config and HostConfig in container remain the same formats. The groups are appended to HostConfig.GroupAdd if needed.

- How to verify it

An additional integration test has bee added.

- Description for the changelog

Support --group in docker 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

@thaJeztah
Copy link
Member

Can you rename this to --group-add instead of --group? then we're good to moving it forward

@yongtang yongtang force-pushed the 25304-docker-service-create-group branch from bbb9d4c to fce2de3 Compare August 19, 2016 01:25
@yongtang
Copy link
Member Author

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")
Copy link
Member

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"

@yongtang yongtang force-pushed the 25304-docker-service-create-group branch 2 times, most recently from c83581e to 9a113ee Compare August 26, 2016 04:17
@vdemeester
Copy link
Member

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 {
Copy link
Member

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.

Copy link
Member Author

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.

@yongtang yongtang force-pushed the 25304-docker-service-create-group branch from 9a113ee to 3af251f Compare August 26, 2016 15:18
@yongtang
Copy link
Member Author

Thanks @cpuguy83. The pull request has been updated. Please let me know if there are any issues.

@cpuguy83
Copy link
Member

LGTM

@cpuguy83
Copy link
Member

moved to docs review

@yongtang
Copy link
Member Author

Thanks @cpuguy83. The docs has been updated for docker service create and docker service update.

@cpuguy83
Copy link
Member

Thanks @yongtang
Can you squash commits?

@yongtang yongtang force-pushed the 25304-docker-service-create-group branch from 880e2a4 to 0e680bb Compare August 26, 2016 17:24
@yongtang
Copy link
Member Author

Thanks @cpuguy83. The pull request has been updated.

@cpuguy83
Copy link
Member

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")
Copy link
Member

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.

Copy link
Member Author

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>
@yongtang yongtang force-pushed the 25304-docker-service-create-group branch from 0e680bb to b31969e Compare August 27, 2016 18:55
@vdemeester
Copy link
Member

docs LGTM 🐯

@cpuguy83
Copy link
Member

LGTM

@cpuguy83 cpuguy83 merged commit d09c04a into moby:master Aug 29, 2016
@yongtang yongtang deleted the 25304-docker-service-create-group branch August 29, 2016 16:27
@thaJeztah thaJeztah added this to the 1.13.0 milestone Sep 13, 2016
thaJeztah added a commit to thaJeztah/docker that referenced this pull request Jan 16, 2017
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>
andrewhsu pushed a commit to docker-archive/docker-ce that referenced this pull request May 19, 2017
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
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 service create --user does not support "group" / "gid"
5 participants