Commit Graph

79 Commits

Author SHA1 Message Date
Yong Tang 1cab3b32a6 Add `--cpus` flag to control cpu resources
This fix tries to address the proposal raised in 27921 and add
`--cpus` flag for `docker run/create`.

Basically, `--cpus` will allow user to specify a number (possibly partial)
about how many CPUs the container will use. For example, on a 2-CPU system
`--cpus 1.5` means the container will take 75% (1.5/2) of the CPU share.

This fix adds a `NanoCPUs` field to `HostConfig` since swarmkit alreay
have a concept of NanoCPUs for tasks. The `--cpus` flag will translate
the number into reused `NanoCPUs` to be consistent.

This fix adds integration tests to cover the changes.

Related docs (`docker run` and Remote APIs) have been updated.

This fix fixes 27921.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-11-04 09:43:10 -07:00
Vincent Demeester 38a582f54c Merge pull request #27857 from vasil-yordanov/docker-service-hostname-2
Adding the hostname option to docker service command
2016-11-04 15:22:55 +01:00
Kunal Kushwaha b8cf9a880e correct handling of volumes while service update.
Updating a service to replace a volume is handled properly now.
Fixes bug#25772

Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2016-11-04 10:15:18 +09:00
Nikolay Milovanov 19b7bc1739 Adding the hostname option to docker service command
Signed-off-by: Nikolay Milovanov <nmil@itransformers.net>
2016-11-03 10:02:14 +00:00
Akihiro Suda 51cb4aa7b8 cli: add `--mount` to `docker run`
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-11-03 07:08:59 +00:00
Sebastiaan van Stijn e279ecacc5 Merge pull request #27979 from allencloud/more-specific-in-service-scale-description
add replicated in service scale command description
2016-11-02 18:01:59 -07:00
allencloud 39e34ed1a3 add replicated in service scale command description
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-11-02 16:15:57 +08:00
Zhang Wei 9eceaa926f Replace all "Filter" field with "Filters" for consistency
In file `api/types/client.go`, some of the "*Options{}" structs own a
`Filters` field while some else have the name of `Filter`, this commit
will rename all `Filter` to `Filters` for consistency. Also `Filters`
is consistent with API with format `/xxx?filters=xxx`, that's why
`Filters` is the right name.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-11-01 23:09:30 +08:00
Lily Guo 378ae7234a Service create --group param
--group-add was used for specifying groups for both service create
and service update. For create it was confusing since we don't have
an existing set of groups. Instead I added --group to create, and
moved --group-add to service update only, like --group-rm
This deals with issue 27646

Signed-off-by: Lily Guo <lily.guo@docker.com>

Update flag documentation

Specify that --group, --group-add and --groupd-rm refers to
supplementary user groups

Signed-off-by: Lily Guo <lily.guo@docker.com>

Fix docs for groups and update completion scripts

Signed-off-by: Lily Guo <lily.guo@docker.com>
2016-10-28 13:26:31 -07:00
Vincent Demeester 4403644a9e Merge pull request #27369 from cezarsa/hc
Add --health-* flags to service create and update
2016-10-28 21:59:52 +02:00
Cezar Sa Espinola 87e916a171 Add --health-* commands to service create and update
A HealthConfig entry was added to the ContainerSpec associated with the
service being created or updated.

Signed-off-by: Cezar Sa Espinola <cezarsa@gmail.com>
2016-10-28 15:19:08 -02:00
Vincent Demeester 4b65bdd802 Merge pull request #27654 from gaocegege/add-quiet-mode-to-service-ps
Add -q option to `docker service ps`
2016-10-28 05:21:03 +02:00
Ce Gao 4c1560e987 fixes #27643
Signed-off-by: Ce Gao <ce.gao@outlook.com>
2016-10-28 08:02:57 +08:00
Sebastiaan van Stijn 881831531a Merge pull request #26988 from thaJeztah/remove-service-update-name-flag
Remove service update name flag
2016-10-27 16:55:47 -07:00
Yong Tang 1250d2afae Add `--env-file` flag to `docker create service`
This fix tries to address the issue in 24712 and add
`--env-file` file to `docker create service`.

Related documentation has been updated.

An additional integration has been added.

This fix fixes 24712.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-10-27 11:48:32 -07:00
Sebastiaan van Stijn 6c80d2bb83 Remove --name flag from service update
The --name flag was inadvertently added to
docker service update, but is not supported,
as it has various side-effects (e.g., existing
tasks are not renamed).

This removes the flag from the service update
command.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-10-27 09:16:29 -07:00
Aaron Lehmann dfed71a6dd Add force option to service update
Currently, there's no way to restart the tasks of a service without
making an actual change to the service. This leads to us giving awkward
workarounds as in
https://github.com/docker/docker.github.io/pull/178/files, where we tell
people to scale a service up and down to restore balance, or make
unnecessary changes to trigger a restart.

This change adds a --force option to "docker service update", which
forces the service to be updated even if no changes require that.

Since rolling update parameters are respected, the user can use
"docker service --force" to do a rolling restart. For example, the
following is supported:

   docker service update --force --update-parallelism 2 \
   --update-delay 5s myservice

Since the default value of --update-parallelism is 1, the default
behavior is to restart the service one task at a time.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-10-21 17:43:27 -07:00
Aaron Lehmann 06ebd4517d Service update failure thresholds and rollback
This adds support for two enhancements to swarm service rolling updates:

- Failure thresholds: In Docker 1.12, a service update could be set up
  to either pause or continue after a single failure occurs. This adds
  an --update-max-failure-ratio flag that controls how many tasks need to
  fail to update for the update as a whole to be considered a failure. A
  counterpart flag, --update-monitor, controls how long to monitor each
  task for a failure after starting it during the update.

- Rollback flag: service update --rollback reverts the service to its
  previous version. If a service update encounters task failures, or
  fails to function properly for some other reason, the user can roll back
  the update.

SwarmKit also has the ability to roll back updates automatically after
hitting the failure thresholds, but we've decided not to expose this in
the Docker API/CLI for now, favoring a workflow where the decision to
roll back is always made by an admin. Depending on user feedback, we may
add a "rollback" option to --update-failure-action in the future.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-10-18 10:09:50 -07:00
yuexiao-wang 24d0191a3a Fix typs from go to Go
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
2016-10-18 19:40:16 +08:00
Akihiro Suda c11155f0d1 Fix broken JSON support in cli/command/formatter
How to test:

    $ docker ps --format '{{json .}}'
    $ docker network ls --format '{{json .}}'
    $ docker volume ls --format '{{json .}}'

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-10-17 08:07:17 +00:00
allencloud 6ef1c7deaf return nil when no node or service to avoid additional api call
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-10-11 10:59:16 +08:00
Vincent Demeester e2870295aa Merge pull request #26697 from allencloud/change-service-scale-logic
validate service parameter in client side to avoid api call in `docker service scale`
2016-09-30 18:37:35 +02:00
Akihiro Suda 2126d8160d Fix cli/command/service/opts_test.go, and add some extra test cases
`m.Set("type=volume,target=/foo,volume-nocopy")` is valid even though it lacks "source"

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-09-27 15:27:02 +00:00
allencloud a16fed83af validate service parameter in client side to avoid api call
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-09-26 17:18:02 +08:00
Vincent Demeester 333a0f348f Merge pull request #25025 from cpuguy83/service_inspect_formatter
Add formatter for service inspect
2016-09-20 14:49:45 +02:00
Brian Goff 20c5a9448d Add formatter for service inspect
Allows the user to use `pretty` as the format string.
This enables users to put custom format options into their CLI config
just like is supported for `docker ps` and `docker images`

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-09-19 16:28:19 -04:00
Daniel Nephin 1f0f7ecb5a Only hide commands if the env variable is set.
Better formatting for usage template.
Group commands in usage to management/operation commands.
Remove the word Docker from the description of management commands.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-09-19 13:28:15 -04:00
Daniel Nephin a26ba0e702 Remove remaining registry methods from DockerCLI.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-09-09 15:50:01 -04:00
Daniel Nephin 3bd1eb4b76 Move api/client -> cli/command
Using
  gomvpkg
     -from github.com/docker/docker/api/client
     -to github.com/docker/docker/cli/command
     -vcs_mv_cmd 'git mv {{.Src}} {{.Dst}}'

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-09-08 15:46:29 -04:00