github.com/vieux/docker@v0.6.3-0.20161004191708-e097c2a938c7/docs/reference/commandline/service_update.md (about) 1 <!--[metadata]> 2 +++ 3 title = "service update" 4 description = "The service update command description and usage" 5 keywords = ["service, update"] 6 [menu.main] 7 parent = "smn_cli" 8 +++ 9 <![end-metadata]--> 10 11 # service update 12 13 ```Markdown 14 Usage: docker service update [OPTIONS] SERVICE 15 16 Update a service 17 18 Options: 19 --args string Service command args 20 --constraint-add value Add or update placement constraints (default []) 21 --constraint-rm value Remove a constraint (default []) 22 --container-label-add value Add or update container labels (default []) 23 --container-label-rm value Remove a container label by its key (default []) 24 --endpoint-mode string Endpoint mode (vip or dnsrr) 25 --env-add value Add or update environment variables (default []) 26 --env-rm value Remove an environment variable (default []) 27 --group-add value Add additional user groups to the container (default []) 28 --group-rm value Remove previously added user groups from the container (default []) 29 --help Print usage 30 --image string Service image tag 31 --label-add value Add or update service labels (default []) 32 --label-rm value Remove a label by its key (default []) 33 --limit-cpu value Limit CPUs (default 0.000) 34 --limit-memory value Limit Memory (default 0 B) 35 --log-driver string Logging driver for service 36 --log-opt value Logging driver options (default []) 37 --mount-add value Add or update a mount on a service 38 --mount-rm value Remove a mount by its target path (default []) 39 --name string Service name 40 --publish-add value Add or update a published port (default []) 41 --publish-rm value Remove a published port by its target port (default []) 42 --replicas value Number of tasks (default none) 43 --reserve-cpu value Reserve CPUs (default 0.000) 44 --reserve-memory value Reserve Memory (default 0 B) 45 --restart-condition string Restart when condition is met (none, on-failure, or any) 46 --restart-delay value Delay between restart attempts (default none) 47 --restart-max-attempts value Maximum number of restarts before giving up (default none) 48 --restart-window value Window used to evaluate the restart policy (default none) 49 --stop-grace-period value Time to wait before force killing a container (default none) 50 --update-delay duration Delay between updates 51 --update-failure-action string Action on update failure (pause|continue) (default "pause") 52 --update-parallelism uint Maximum number of tasks updated simultaneously (0 to update all at once) (default 1) 53 -u, --user string Username or UID (format: <name|uid>[:<group|gid>]) 54 --with-registry-auth Send registry authentication details to Swarm agents 55 -w, --workdir string Working directory inside the container 56 ``` 57 58 Updates a service as described by the specified parameters. This command has to be run targeting a manager node. 59 The parameters are the same as [`docker service create`](service_create.md). Please look at the description there 60 for further information. 61 62 ## Examples 63 64 ### Update a service 65 66 ```bash 67 $ docker service update --limit-cpu 2 redis 68 ``` 69 70 ### Adding and removing mounts 71 72 Use the `--mount-add` or `--mount-rm` options add or remove a service's bind-mounts 73 or volumes. 74 75 The following example creates a service which mounts the `test-data` volume to 76 `/somewhere`. The next step updates the service to also mount the `other-volume` 77 volume to `/somewhere-else`volume, The last step unmounts the `/somewhere` mount 78 point, effectively removing the `test-data` volume. Each command returns the 79 service name. 80 81 - The `--mount-add` flag takes the same parameters as the `--mount` flag on 82 `service create`. Refer to the [volumes and 83 bind-mounts](service_create.md#volumes-and-bind-mounts-mount) section in the 84 `service create` reference for details. 85 86 - The `--mount-rm` flag takes the `target` path of the mount. 87 88 ```bash 89 $ docker service create \ 90 --name=myservice \ 91 --mount \ 92 type=volume,source=test-data,target=/somewhere \ 93 nginx:alpine \ 94 myservice 95 96 myservice 97 98 $ docker service update \ 99 --mount-add \ 100 type=volume,source=other-volume,target=/somewhere-else \ 101 myservice 102 103 myservice 104 105 $ docker service update --mount-rm /somewhere myservice 106 107 myservice 108 ``` 109 110 ## Related information 111 112 * [service create](service_create.md) 113 * [service inspect](service_inspect.md) 114 * [service ps](service_ps.md) 115 * [service ls](service_ls.md) 116 * [service rm](service_rm.md)