> For the complete documentation index, see [llms.txt](https://camelgemonion.gitbook.io/docker/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://camelgemonion.gitbook.io/docker/dockercompose.yaml-wen-jian-zhong-chang-yong-zhi-ling/untitled-12/untitled-2/untitled-9.md).

# Update\_config

该选项用来配置服务如何被更新。对于配置滚动更新非常有用。

* parallelism：同一时间更新容器的数量。
* delay：一组容器更新的等待时间间隔(默认是0s)。
* failure\_action：设置更新失败以后的操作。有两种形式：continue，rollback，pause(默认是pause)
* monitor：每次任务更新后，监控故障的持续时间(ns|us|ms|s|m|h)(默认是5s)。Note：设置为0将使用默认值5s。
* max\_failure\_ratio: 更新期间失败率的容忍度(默认为0)。
* order: 更新时执行操作的顺序。stop-first(在启动新的容器前，先停止老的容器)。start-first(先启动新的任务，并重复执行该操作)(默认是stop-first)。Note: 只支持v3.4+的版本。

```
version: "3.9"
services:
  vote:
    image: dockersamples/examplevotingapp_vote:before
    depends_on:
      - redis
    deploy:
      replicas: 2
      update_config:
        parallelism: 2
        delay: 10s
        order: stop-first
```
