ディレクトリ 検索
Compose About versions and upgrading (Compose) ASP.NET Core + SQL Server on Linux (Compose) CLI environment variables (Compose) Command-line completion (Compose) Compose(组成) Compose command-line reference(组合命令行参考) Control startup order (Compose) Django and PostgreSQL (Compose) Docker stacks and distributed application bundles (Compose) docker-compose build(docker-compose构建) docker-compose bundle docker-compose config docker-compose create docker-compose down docker-compose events docker-compose exec docker-compose help docker-compose images docker-compose kill docker-compose logs docker-compose pause docker-compose port docker-compose ps docker-compose pull docker-compose push docker-compose restart docker-compose rm docker-compose run docker-compose scale docker-compose start docker-compose stop docker-compose top docker-compose unpause docker-compose up Environment file (Compose) Environment variables in Compose Extend services in Compose Frequently asked questions (Compose) Getting started (Compose) Install Compose Link environment variables (deprecated) (Compose) Networking in Compose Overview of Docker Compose Overview of docker-compose CLI Quickstart: Compose and WordPress Rails and PostgreSQL (Compose) Sample apps with Compose Using Compose in production Using Compose with Swarm Engine .NET Core application (Engine) About images, containers, and storage drivers (Engine) Add nodes to the swarm (Engine) Apply custom metadata (Engine) Apply rolling updates (Engine) apt-cacher-ng Best practices for writing Dockerfiles (Engine) Binaries (Engine) Bind container ports to the host (Engine) Breaking changes (Engine) Build your own bridge (Engine) Configure container DNS (Engine) Configure container DNS in user-defined networks (Engine) CouchDB (Engine) Create a base image (Engine) Create a swarm (Engine) Customize the docker0 bridge (Engine) Debian (Engine) Default bridge network Delete the service (Engine) Deploy a service (Engine) Deploy services to a swarm (Engine) Deprecated Engine features Docker container networking (Engine) Docker overview (Engine) Docker run reference (Engine) Dockerfile reference (Engine) Dockerize an application Drain a node (Engine) Engine FAQ (Engine) Fedora (Engine) Get started (Engine) Get started with macvlan network driver (Engine) Get started with multi-host networking (Engine) How nodes work (Engine) How services work (Engine) Image management (Engine) Inspect the service (Engine) Install Docker (Engine) IPv6 with Docker (Engine) Join nodes to a swarm (Engine) Legacy container links (Engine) Lock your swarm (Engine) Manage nodes in a swarm (Engine) Manage sensitive data with Docker secrets (Engine) Manage swarm security with PKI (Engine) Manage swarm service networks (Engine) Migrate to Engine 1.10 Optional Linux post-installation steps (Engine) Overview (Engine) PostgreSQL (Engine) Raft consensus in swarm mode (Engine) Riak (Engine) Run Docker Engine in swarm mode Scale the service (Engine) SDKs (Engine) Select a storage driver (Engine) Set up for the tutorial (Engine) SSHd (Engine) Storage driver overview (Engine) Store service configuration data (Engine) Swarm administration guide (Engine) Swarm mode key concepts (Engine) Swarm mode overlay network security model (Engine) Swarm mode overview (Engine) Understand container communication (Engine) Use multi-stage builds (Engine) Use swarm mode routing mesh (Engine) Use the AUFS storage driver (Engine) Use the Btrfs storage driver (Engine) Use the Device mapper storage driver (Engine) Use the OverlayFS storage driver (Engine) Use the VFS storage driver (Engine) Use the ZFS storage driver (Engine) Engine: Admin Guide Amazon CloudWatch logs logging driver (Engine) Bind mounts (Engine) Collect Docker metrics with Prometheus (Engine) Configuring and running Docker (Engine) Configuring logging drivers (Engine) Control and configure Docker with systemd (Engine) ETW logging driver (Engine) Fluentd logging driver (Engine) Format command and log output (Engine) Google Cloud logging driver (Engine) Graylog Extended Format (GELF) logging driver (Engine) Journald logging driver (Engine) JSON File logging driver (Engine) Keep containers alive during daemon downtime (Engine) Limit a container's resources (Engine) Link via an ambassador container (Engine) Log tags for logging driver (Engine) Logentries logging driver (Engine) PowerShell DSC usage (Engine) Prune unused Docker objects (Engine) Run multiple services in a container (Engine) Runtime metrics (Engine) Splunk logging driver (Engine) Start containers automatically (Engine) Storage overview (Engine) Syslog logging driver (Engine) tmpfs mounts Troubleshoot volume problems (Engine) Use a logging driver plugin (Engine) Using Ansible (Engine) Using Chef (Engine) Using Puppet (Engine) View a container's logs (Engine) Volumes (Engine) Engine: CLI Daemon CLI reference (dockerd) (Engine) docker docker attach docker build docker checkpoint docker checkpoint create docker checkpoint ls docker checkpoint rm docker commit docker config docker config create docker config inspect docker config ls docker config rm docker container docker container attach docker container commit docker container cp docker container create docker container diff docker container exec docker container export docker container inspect docker container kill docker container logs docker container ls docker container pause docker container port docker container prune docker container rename docker container restart docker container rm docker container run docker container start docker container stats docker container stop docker container top docker container unpause docker container update docker container wait docker cp docker create docker deploy docker diff docker events docker exec docker export docker history docker image docker image build docker image history docker image import docker image inspect docker image load docker image ls docker image prune docker image pull docker image push docker image rm docker image save docker image tag docker images docker import docker info docker inspect docker kill docker load docker login docker logout docker logs docker network docker network connect docker network create docker network disconnect docker network inspect docker network ls docker network prune docker network rm docker node docker node demote docker node inspect docker node ls docker node promote docker node ps docker node rm docker node update docker pause docker plugin docker plugin create docker plugin disable docker plugin enable docker plugin inspect docker plugin install docker plugin ls docker plugin push docker plugin rm docker plugin set docker plugin upgrade docker port docker ps docker pull docker push docker rename docker restart docker rm docker rmi docker run docker save docker search docker secret docker secret create docker secret inspect docker secret ls docker secret rm docker service docker service create docker service inspect docker service logs docker service ls docker service ps docker service rm docker service scale docker service update docker stack docker stack deploy docker stack ls docker stack ps docker stack rm docker stack services docker start docker stats docker stop docker swarm docker swarm ca docker swarm init docker swarm join docker swarm join-token docker swarm leave docker swarm unlock docker swarm unlock-key docker swarm update docker system docker system df docker system events docker system info docker system prune docker tag docker top docker unpause docker update docker version docker volume docker volume create docker volume inspect docker volume ls docker volume prune docker volume rm docker wait Use the Docker command line (Engine) Engine: Extend Access authorization plugin (Engine) Docker log driver plugins Docker network driver plugins (Engine) Extending Engine with plugins Managed plugin system (Engine) Plugin configuration (Engine) Plugins API (Engine) Volume plugins (Engine) Engine: Security AppArmor security profiles for Docker (Engine) Automation with content trust (Engine) Content trust in Docker (Engine) Delegations for content trust (Engine) Deploying Notary (Engine) Docker security (Engine) Docker security non-events (Engine) Isolate containers with a user namespace (Engine) Manage keys for content trust (Engine) Play in a content trust sandbox (Engine) Protect the Docker daemon socket (Engine) Seccomp security profiles for Docker (Engine) Secure Engine Use trusted images Using certificates for repository client verification (Engine) Engine: Tutorials Engine tutorials Network containers (Engine) Get Started Part 1: Orientation Part 2: Containers Part 3: Services Part 4: Swarms Part 5: Stacks Part 6: Deploy your app Machine Amazon Web Services (Machine) Digital Ocean (Machine) docker-machine active docker-machine config docker-machine create docker-machine env docker-machine help docker-machine inspect docker-machine ip docker-machine kill docker-machine ls docker-machine provision docker-machine regenerate-certs docker-machine restart docker-machine rm docker-machine scp docker-machine ssh docker-machine start docker-machine status docker-machine stop docker-machine upgrade docker-machine url Driver options and operating system defaults (Machine) Drivers overview (Machine) Exoscale (Machine) Generic (Machine) Get started with a local VM (Machine) Google Compute Engine (Machine) IBM Softlayer (Machine) Install Machine Machine Machine CLI overview Machine command-line completion Machine concepts and help Machine overview Microsoft Azure (Machine) Microsoft Hyper-V (Machine) Migrate from Boot2Docker to Machine OpenStack (Machine) Oracle VirtualBox (Machine) Provision AWS EC2 instances (Machine) Provision Digital Ocean Droplets (Machine) Provision hosts in the cloud (Machine) Rackspace (Machine) VMware Fusion (Machine) VMware vCloud Air (Machine) VMware vSphere (Machine) Notary Client configuration (Notary) Common Server and signer configurations (Notary) Getting started with Notary Notary changelog Notary configuration files Running a Notary service Server configuration (Notary) Signer configuration (Notary) Understand the service architecture (Notary) Use the Notary client
テキスト

描述

更新服务

使用

docker service update [OPTIONS] SERVICE

备选方案

名字,简写

默认

描述

--args


服务命令参数

--config-add


添加或更新服务上的配置文件

--config-RM


删除配置文件

--constraint-add


添加或更新展示位置约束

--constraint-RM


删除约束

--container-label-add


添加或更新容器标签

--container-label-rm


用钥匙取出容器标签

--credential-spec


托管服务帐户的凭证规范(仅限Windows)

--detach,-d

立即退出,而不是等待服务收敛

--dns-add


添加或更新自定义DNS服务器

--dns-option-add


添加或更新DNS选项

--dns-option-rm


删除一个DNS选项

--dns-rm


删除自定义的DNS服务器

--dns-search-add


添加或更新自定义DNS搜索域

--dns-search-rm


删除一个DNS搜索域

--endpoint-mode


端点模式(vip或dnsrr)

--entrypoint


覆盖图像的默认入口点

--env-add


添加或更新环境变量

--env-RM


删除一个环境变量

--force

即使没有更改需要,也强制更新

--group-add


向容器添加一个附加的补充用户组

--group-RM


从容器中删除先前添加的补充用户组

--health-cmd


运行以检查运行状况的命令

--health-interval


运行检查之间的时间(ms | s | m | h)

--health-retries

0

需要报告不健康的连续失败

--health-retries


在重新计数到不稳定(ms | s | m | h)之前,容器初始化的开始时间段

--health-timeout


允许一次检查运行的最长时间(ms | s | m | h)

--host加


添加或更新自定义主机到IP映射(主机:IP)

--host-RM


删除自定义的主机到IP映射(主机:IP)

--hostname


容器主机名

--image


服务图片标签

--label-add


添加或更新服务标签

--label-RM


用钥匙去除标签

--limit-CPU


限制CPU

--limit-memory

0

限制记忆

--log-driver


记录驱动程序的服务

--log-OPT


记录驱动程序选项

--mount-add


添加或更新服务上的装载

--mount-RM


通过目标路径移除一个安装

--network加


添加一个网络

--network-RM


删除网络

--no-healthcheck

禁用任何容器指定的HEALTHCHECK

--no-resolve-image

不要查询注册表来解析图像摘要和支持的平台

--placement-PREF-ADD


添加展示位置首选项

--placement-PREF-RM


删除展示位置偏好设置

--publish相加


添加或更新已发布的端口

--publish-RM


通过目标端口删除发布的端口

--quiet,-q

抑制进度输出

--read-only

将容器的根文件系统挂载为只读

--replicas


任务数量

--reserve-CPU


预留CPU

--reserve-memory

0

保留内存

--restart-condition


条件满足时重新启动(“none”|“on-failure”|“any”)

--restart-delay


重启尝试之间的延迟(ns | us | ms | s | m | h)

--restart-max-attempts


放弃前的最大重启次数

--restart-window


用于评估重新启动策略的窗口(ns | us | ms | s | m | h)

--rollback

回退到先前的规范

--rollback-delay

0

任务回滚之间的延迟(ns | us | ms | s | m | h)

--rollback-failure-action


回滚失败的操作(“暂停”|“继续”)

--rollback-max-failure-ratio

0

在回滚期间容忍的失败率

--rollback-monitor

0

每个任务回滚后监视失败的持续时间(ns | us | ms | s | m | h)

--rollback-order


回滚顺序(“start-first”|“stop-first”)

--rollback-parallelism

0

同时回滚的任务的最大数量(0一次全部回滚)

--secret-add


添加或更新服务的秘密

--secret-RM


去掉一个秘密

--stop-grace-period


强制杀死一个容器之前的等待时间(ns | us | ms | s | m | h)

--stop-signal


停止容器的信号

--tty, -t

分配一个伪TTY

--update-delay

0

更新之间的延迟(ns | us | ms | s | m | h)

--update-failure-action


更新失败的操作(“暂停”|“继续”|“回滚”)

--update-max-failure-ratio

0

更新期间容错的失败率

--update-monitor

0

(ns | us | ms | s | m | h)每个任务更新后的持续时间

--update-order


更新顺序(“start-first”|“stop-first”)

--update-parallelism

0

同时更新的最大任务数(0个一次全部更新)

--user,-u


用户名或UID(格式:<名称| uid>:<组| gid>)

--with-registry-auth

向注册代理发送注册表认证详细信息

--workdir,-w


容器内的工作目录

父命令

命令

描述

docker 服务

管理服务

相关命令

命令

描述

docker  服务创建

创建一项新服务

docker  服务检查

显示一项或多项服务的详细信息

docker  服务日志

获取服务或任务的日志

docker  服务ls

列出服务

docker  服务ps

列出一项或多项服务的任务

docker  服务rm

删除一项或多项服务

docker  服务规模

扩展一个或多个复制服务

docker  服务更新

更新服务

扩展描述

按照指定的参数描述更新服务。该命令必须以管理器节点为目标运行。参数与docker service create。相同。请参阅描述以获取更多信息。

通常,更新服务只会导致服务的任务被替换为新服务,如果对服务的更改需要重新创建任务才能生效。例如,只有更改--update-parallelism设置才会重新创建任务,因为单个任务不受此设置的影响。但是,--force标志将导致任务被重新创建。这可以用来执行滚动重启,而不会对服务参数进行任何更改。

实例

更新服务

$ docker service update --limit-cpu 2 redis

执行滚动重新启动,不更改参数。

$ docker service update --force --update-parallelism 1 --update-delay 30s redis

在这个例子中,--force标志导致服务的任务被关闭并被新的替换,即使其他参数通常都不会导致这种情况发生。--update-parallelism 1设置确保一次只替换一个任务(这是默认行为)。--update-delay 30s设置在任务之间引入了30秒的延迟,以便滚动重启逐渐发生。

添加或移除挂载

使用--mount-add--mount-rm选项添加或删除服务的绑定挂载或volume。

以下示例创建一个将test-datavolume挂载到的服务/somewhere。下一步更新服务以将other-volumevolume挂接到/somewhere-elsevolume,最后一步卸载/somewhere挂载点,从而有效地移除test-datavolume。每个命令都会返回服务名称。

  • --mount-add标志采用了相同的参数--mount上的标志service create。有关详细信息,请参阅参考中的volume和绑定挂载部分service create

  • --mount-rm标志采用target安装路径。

$ docker service create \    --name=myservice \    --mount \
      type=volume,source=test-data,target=/somewhere \
    nginx:alpine \
    myservice

myservice

$ docker service update \    --mount-add \
      type=volume,source=other-volume,target=/somewhere-else \
    myservice

myservice

$ docker service update --mount-rm /somewhere myservice

myservice

恢复到服务的以前版本。

使用--rollback选项恢复到服务的前一个版本。

这将使服务恢复到最近一次配置之前的配置。docker service update命令。

下面的示例将服务的副本数量从4更新到5,然后回滚到以前的配置。

$ docker service update --replicas=5 web

web

$ docker service ls

ID            NAME  MODE        REPLICAS  IMAGE
80bvrzp6vxf3  web   replicated  0/5       nginx:alpine

回滚web服务...

$ docker service update --rollback web

web

$ docker service ls

ID            NAME  MODE        REPLICAS  IMAGE
80bvrzp6vxf3  web   replicated  0/4       nginx:alpine

其他选项也可以结合使用--rollback,例如,--update-delay 0s执行任务之间没有延迟的回滚:

$ docker service update \  --rollback \  --update-delay 0s
  web

web

服务也可以设置为在更新失败时自动回滚到以前的版本。要设置自动回滚服务,请使用--update-failure-action=rollback。如果成功更新失败的部分任务超过了给定的值,将会触发回滚--update-max-failure-ratio

恢复操作的速率,并行性和其他参数由通过以下标志传递的值确定:

  • --rollback-delay

  • --rollback-failure-action

  • --rollback-max-failure-ratio

  • --rollback-monitor

  • --rollback-parallelism

例如,设置的服务--update-parallelism 1 --rollback-parallelism 3将在正常更新期间一次更新一个任务,但在回滚期间,一次会执行3个任务。这些回滚参数在自动回滚和使用手动启动--rollback的回滚期间都被重视。

添加或删除秘密

使用--secret-add--secret-rm选项添加或删除服务的机密。

以下示例添加一个名为ssh-2并删除的秘密ssh-1

$ docker service update \    --secret-add source=ssh-2,target=ssh-2 \    --secret-rm ssh-1 \
    myservice

使用模板更新服务

service update支持使用模板的一些标志。请参阅service create参考。

前の記事: 次の記事: