Commit Graph

89 Commits

Author SHA1 Message Date
Sebastiaan van Stijn 2b976720f4
docs: add anchor-tags for flags
This will generate "details_url" for options, so that the options
table on the pages at docs.docker.com link to the section describing
the option.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-30 15:05:29 +02:00
Sebastiaan van Stijn 47ba76afb1
docs: use "console" code-hint for shell examples
This replaces the use of bash where suitable, to allow easier copy/pasting
of shell examples without copying the prompt or process output.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-21 18:29:13 +02:00
Albin Kerouanton a9158bdc50
Add ulimits option to docker service create/update/inspect
This is related to moby/moby 40639.

Signed-off-by: Albin Kerouanton <albin@akerouanton.name>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-09-10 14:41:33 +02:00
Sebastiaan van Stijn 190c64b415
Service cap-add/cap-drop: improve handling of combinations and special "ALL" value
When creating and updating services, we need to avoid unneeded service churn.

The interaction of separate lists to "add" and "drop" capabilities, a special
("ALL") capability, as well as a "relaxed" format for accepted capabilities
(case-insensitive, `CAP_` prefix optional) make this rather involved.

This patch updates how we handle `--cap-add` / `--cap-drop` when  _creating_ as
well as _updating_, with the following rules/assumptions applied:

- both existing (service spec) and new (values passed through flags or in
  the compose-file) are normalized and de-duplicated before use.
- the special "ALL" capability is equivalent to "all capabilities" and taken
  into account when normalizing capabilities. Combining "ALL" capabilities
  and other capabilities is therefore equivalent to just specifying "ALL".
- adding capabilities takes precedence over dropping, which means that if
  a capability is both set to be "dropped" and to be "added", it is removed
  from the list to "drop".
- the final lists should be sorted and normalized to reduce service churn
- no validation of capabilities is handled by the client. Validation is
  delegated to the daemon/server.

When deploying a service using a docker-compose file, the docker-compose file
is *mostly* handled as being "declarative". However, many of the issues outlined
above also apply to compose-files, so similar handling is applied to compose
files as well to prevent service churn.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-09-08 14:38:35 +02:00
Sebastiaan van Stijn 395a6d560d
Add support for --limit-pids on service create / update (swarm)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-06-18 21:25:02 +02:00
Sebastiaan van Stijn 4f058143c7
Merge pull request #2262 from dperny/swarm-jobs
Add jobs support to CLI
2020-05-06 17:00:01 +02:00
Drew Erny 9375644e34 Add jobs support to CLI
* Added two new modes accepted by the `--mode` flag
  * `replicated-job` creates a replicated job
  * `global-job` creates a global job.
* When using `replicated-job` mode, the `replicas` flag sets the
  `TotalCompletions` parameter of the job. This is the total number of
  tasks that will run
* Added a new flag, `max-concurrent`, for use with `replicated-job`
  mode. This flag sets the `MaxConcurrent` parameter of the job, which
  is the maximum number of replicas the job will run simultaneously.
* When using `replicated-job` or `global-job` mode, using any of the
  update parameter flags will result in an error, as jobs cannot be
  updated in the traditional sense.
* Updated the `docker service ls` UI to include the completion status
  (completed vs total tasks) if the service is a job.
* Updated the progress bars UI for service creation and update to
  support jobs. For jobs, there is displayed a bar covering the overall
  progress of the job (the number of tasks completed over the total
  number of tasks to complete).
* Added documentation explaining the use of the new flags, and of jobs
  in general.

Signed-off-by: Drew Erny <derny@mirantis.com>
2020-04-24 11:22:10 -05:00
Sebastiaan van Stijn 0cd7c6aa02
service update: fix service create example
Service create expects the name to be passed using the
`--name` flag, not as a positional parameter

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-24 13:42:04 +02:00
Sebastiaan van Stijn 6ae5df423a
reference docs: reformat notes
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-19 17:52:26 +02:00
Sebastiaan van Stijn 8919c228bd
reference docs: fix broken links and markdown touch-ups
- fix various broken links
- fix incorrect anchors
- updated links for content that moved, so that no
  redirect to the new location is needed.
- touched-up Markdown;
  - re-format some JSON output
  - add blank line betweeen command and command output
  - format "note" blocks

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-19 17:13:07 +02:00
Sebastiaan van Stijn f30bde6adb
remove unneeded comment from reference files
these markdown files are not consumed directly in the docs,
but only their content is included through the YAML does,
so there's no need to have these comments in them

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-19 15:15:23 +01:00
Sebastiaan van Stijn f540eae7fe
Docs: add note about management commands targeting a manager
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-12-12 14:57:05 +01:00
Sebastiaan van Stijn f620349837
Add systctl support for services
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-19 13:33:32 +01:00
Vincent Demeester ff13f03def
Add --init option to `docker service create`
Signed-off-by: Timothy Higinbottom <timhigins@gmail.com>
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-14 13:50:12 +02:00
Alexander Ryabov 94ecd2ba73 Document service --network long form
Signed-off-by: Alexander Ryabov <i@sepa.spb.ru>
2018-02-16 09:34:42 +03:00
Lachlan Cooper 90f44e564b
Correct references to --publish long syntax in docs
This is the same issue as described at docker/docker.github.io#5370

Signed-off-by: Lachlan Cooper <lachlancooper@gmail.com>
2017-12-13 10:25:43 +11:00
Renaud Gaubert 20a6ff32ee Added support for generic resource update
Signed-off-by: Renaud Gaubert <renaud.gaubert@gmail.com>
2017-11-28 18:03:10 +01:00
Vincent Demeester 5e2be6584a
Merge pull request #426 from simonferquel/service-isolation
--isolation for setting swarm service isolation mode
2017-11-17 15:39:43 +01:00
Simon Ferquel 47cf2ea683 Add isolation mode on service update/create and compose files
Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2017-11-17 15:31:13 +01:00
Misty Stanley-Jones 9ef7caa6fe Add info about new port mapping syntax
Signed-off-by: Misty Stanley-Jones <misty@docker.com>
2017-11-15 17:58:13 -08:00
Sebastiaan van Stijn 79b19cba16
Fix flag description for --host-add
The `--host-add` flag adds a new `host:ip` mapping. Even though
adding an entry is idempotent (adding the same mapping multiple
times does not update the service's definition), it does not
_update_  an existing mapping with a new IP-address (multiple
IP-addresses can be defined for a host).

This patch removes the "or update" part from the flag's
description.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-10-28 16:47:53 +02:00
Frieder Bluemle 45c9b9b6c1
Fix GitHub spelling
Signed-off-by: Frieder Bluemle <frieder.bluemle@gmail.com>
2017-10-05 01:14:31 +08:00
Christophe Vidal 037029414d Dropped hyphen in bind mount where appropriate
Signed-off-by: Christophe Vidal <kriss@krizalys.com>
2017-08-19 21:14:48 +07:00
Jimmy Leger 11d471d660 Add 'docker service rollback' subcommand
Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Implement runRollback to not use runUpdate

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Add version tag and add flag quiet to suppress progress output

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Removed flags from warnDetachDefault

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Used command.Cli interface

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Add detach flag on rollback command

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Create a fakeClient for service commands

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Added unit test for rollback command

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Used command.Cli interface instead of *command.DockerCli in service commands

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Revert "Removed flags from warnDetachDefault"

This reverts commit 3e4f601c8a82cc2599a755dc693409bbc47917fc.

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Fixed test.NewFakeCli instanciation

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Removed unused receiver

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Replaced cli by dockerCli

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Revert "Removed unused receiver"

This reverts commit 604ef7c13df3d019949ca81d992db501114dafce.

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>

Fixed last typo

Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>
2017-08-16 22:18:36 +02:00
zebrilee 5fe09164f5 update service create and update options in commandline documentation
Signed-off-by: zebrilee <zebrilee@gmail.com>
2017-07-31 23:26:02 +02:00
Kir Kolyshkin 6d85a4f5f8 Fix repo references in docs
Since CLI was moved to a separate repo, these references are incorrect.
Fixed with the help of sed script, verified manually.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2017-07-28 10:32:42 -07:00
Sebastiaan van Stijn 5cc7ac2990 Service privileges: CLI reference docs & completion
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-07-14 22:30:47 -07:00
Dong Chen 1fa8221743 do not allow duration less than 1 ms in healthcheck parameters
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2017-06-02 00:11:04 +00:00
Aaron Lehmann 91ca194713 Make the CLI show defaults from the swarmkit defaults package
If no fields related to an update config or restart policy are
specified, these structs should not be created as part of the service,
to avoid hardcoding the current defaults.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-06-02 00:11:03 +00:00
Aaron Lehmann fc6428390a cli: Allow service's networks to be updated
Resolve networks IDs on the client side.

Avoid filling in deprecated Spec.Networks field.

Sort networks in the TaskSpec for update stability.

Add an integration test for changing service networks.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-06-02 00:11:02 +00:00
Aaron Lehmann e434a91221 Add support for update order
This parameter controls the order of operations when rolling out an
update task. Either the old task is stopped before starting the new one,
or the new task is started first, and the running tasks will briefly
overlap.

This commit adds Rollout to the API, and --update-order / --rollback-order
flags to the CLI.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-06-02 00:11:02 +00:00
Elias Faxö c5071b94da Added start period option to health check.
Signed-off-by: Elias Faxö <elias.faxo@gmail.com>
2017-06-02 00:11:02 +00:00
Aaron Lehmann c8e607205f Synchronous service create and service update
Change "service create" and "service update" to wait until the creation
or update finishes, when --detach=false is specified. Show progress bars
for the overall operation and for each individual task (when there are a
small enough number of tasks), unless "-q" / "--quiet" is specified.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-06-02 00:11:01 +00:00
erxian ffd24bd8e8 misleading default for --update-monitor duration
Signed-off-by: erxian <evelynhsu21@gmail.com>
2017-06-02 00:10:58 +00:00
Aaron Lehmann 33ae729456 Add support for rollback flags
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-06-02 00:10:56 +00:00
Aaron Lehmann 8271c2a624 Add support for the "rollback" failure action
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-06-02 00:10:56 +00:00
Aaron Lehmann 0248b4df54 Topology-aware scheduling
This adds support for placement preferences in Swarm services.

- Convert PlacementPreferences between GRPC API and HTTP API
- Add --placement-pref, --placement-pref-add and --placement-pref-rm to CLI
- Add support for placement preferences in service inspect --pretty
- Add integration test

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-06-02 00:10:56 +00:00
Yong Tang e9457714cf Add `--stop-signal` for `service create` and `service update`
This fix tries to address the issue raised in 25696 where
it was not possible to specify `--stop-signal` for `docker service create`
and `docker service update`, in order to use special signal to stop
the container.

This fix adds `--stop-signal` and update the `StopSignal` in `Config`
through `service create` and `service update`.

Related docs has been updated.

Integration test has been added.

This fix fixes 25696.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-06-02 00:10:56 +00:00
yupengzte 6f3f9e384c fix the type
Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
2017-06-02 00:10:55 +00:00
erxian 1869390de8 add rollback explanation to docker service update command document
Signed-off-by: erxian <evelynhsu21@gmail.com>
2017-06-02 00:10:55 +00:00
Misty Stanley-Jones ddadd3db49 Standardized formatting of CLI reference commands
Command name should be a H1

Only Description, Examples, and Related Commands should be H2

Changed 'Related information' heading to 'Related commands' since 99% it is only linking commands

Added some examples where relevant

Signed-off-by: Misty Stanley-Jones <misty@docker.com>
2017-06-02 00:10:53 +00:00
allencloud 2726013423 add endpoint mode a default value
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-06-02 00:10:52 +00:00
Yong Tang d75f24fd9d Update opts.MemBytes to disable default, and move `docker run/create/build` to use opts.MemBytes
This fix made several updates:
1. Update opts.MemBytes so that default value will not show up.
   The reason is that in case a default value is decided by daemon,
   instead of client, we actually want to not show default value.
2. Move `docker run/create/build` to use opts.MemBytes for `--shm-size`
   This is to bring consistency between daemon and docker run
3. docs updates.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-06-02 00:10:52 +00:00
Yong Tang 8235af9772 Add `--read-only` for `service create` and `service update`
This fix tries to address the issue raised in 29972 where
it was not possible to specify `--read-only` for `docker service create`
and `docker service update`, in order to have the container's root file
system to be read only.

This fix adds `--read-only` and update the `ReadonlyRootfs` in `HostConfig`
through `service create` and `service update`.

Related docs has been updated.

Integration test has been added.

This fix fixes 29972.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-06-02 00:10:51 +00:00
Yong Tang 87b4281f62 Fix misleading default for `--replicas`
This fix tries to address the issue raised in 29291 where
the output of `--replicas` in `service create/update`:
```
      --replicas uint                    Number of tasks (default none)
```
is misleading. User might incorrectly assume the number of replicas
would be `0` (`none`) by default, while the actual default is `1`.

The issue comes from the fact that some of the default values are
from daemon and it is not possible for client to find out the default
value.

In this case, it might be better to just simply not displaying `(default none)`.

This fix returns "" for `Uint64Opt` so that `(default none)` is hidden.

In addition to `--replicas`, this fix also changes
`--restart-delay`, `--restart-max-attempts`, `--stop-grace-period`,
`--health-interval`, `--health-timeout`, and `--restart-window`
in a similiar fashion.

New Output:
```
      --health-interval duration         Time between running the check (ns|us|ms|s|m|h)
      --health-timeout duration          Maximum time to allow one check to run (ns|us|ms|s|m|h)
...
      --replicas uint                    Number of tasks
...
      --restart-delay duration           Delay between restart attempts (ns|us|ms|s|m|h)
      --restart-max-attempts uint        Maximum number of restarts before giving up
      --restart-window duration          Window used to evaluate the restart policy (ns|us|ms|s|m|h)
...
      --stop-grace-period duration       Time to wait before force killing a container (ns|us|ms|s|m|h)
```

The docs has been updated. Note the docs for help output of `service create/update`
is out of sync with the current master. This fix replace with the update-to-date
help output.

This fix fixes 29291.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-06-02 00:10:45 +00:00
yuexiao-wang 932211ddc7 Add the link for service logs
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
2017-06-02 00:10:44 +00:00
Daniel Nephin f31ed0b125 Allow hostname to be updated on service.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-02 00:10:41 +00:00
Vincent Demeester 594b69d1ff Add documentation about templating support on…
… services creation/update.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-06-02 00:10:40 +00:00
Aaron Lehmann 53ef5c34c0 cli: Add valid suffixes for remaining duration options
A recent PR added `(ns|us|ms|s|m|h)` to the descriptions of some
duration options, but not all. Add it to the remaining options for
consistency.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-06-02 00:10:39 +00:00
Yong Tang 9cda7c331e Add flag `--host` to `service create` and `--host-add/--host-rm` to `service update`
This fix tries to address 27902 by adding a flag `--host`
to `docker service create` and `--host-add/--host-rm` to
`docker service update`, so that it is possible to
specify extra `host:ip` settings in `/etc/hosts`.

This fix adds `Hosts` in swarmkit's `ContainerSpec` so that it
is possible to specify extra hosts during service creation.

Related docs has been updated.

An integration test has been added.

This fix fixes 27902.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-06-02 00:10:37 +00:00