# ServiceSpec


[API catalog](/reference/api/) · [Docker Engine overview](/reference/api/engine/version/v1.57/) · [Product manual](https://docs.docker.com/engine/) · [OpenAPI specification](/reference/api/engine/version/v1.57.yaml)

API version: 1.57





Schema constraints and annotations:

```json
{
  "description": "User modifiable configuration for a service.",
  "properties": {
    "EndpointSpec": {
      "$ref": "#/components/schemas/EndpointSpec"
    },
    "Labels": {
      "additionalProperties": {
        "type": "string"
      },
      "description": "User-defined key/value metadata.",
      "type": "object"
    },
    "Mode": {
      "description": "Scheduling mode for the service.",
      "properties": {
        "Global": {
          "type": "object"
        },
        "GlobalJob": {
          "description": "The mode used for services which run a task to the completed state\non each valid node.\n",
          "type": "object"
        },
        "Replicated": {
          "properties": {
            "Replicas": {
              "format": "int64",
              "type": "integer"
            }
          },
          "type": "object"
        },
        "ReplicatedJob": {
          "description": "The mode used for services with a finite number of tasks that run\nto a completed state.\n",
          "properties": {
            "MaxConcurrent": {
              "default": 1,
              "description": "The maximum number of replicas to run simultaneously.\n",
              "format": "int64",
              "type": "integer"
            },
            "TotalCompletions": {
              "description": "The total number of replicas desired to reach the Completed\nstate. If unset, will default to the value of `MaxConcurrent`\n",
              "format": "int64",
              "type": "integer"
            }
          },
          "type": "object"
        }
      },
      "type": "object"
    },
    "Name": {
      "description": "Name of the service.",
      "type": "string"
    },
    "Networks": {
      "description": "Specifies which networks the service should attach to.\n\nDeprecated: This field is deprecated since v1.44. The Networks field in TaskSpec should be used instead.\n",
      "items": {
        "$ref": "#/components/schemas/NetworkAttachmentConfig"
      },
      "type": "array"
    },
    "RollbackConfig": {
      "description": "Specification for the rollback strategy of the service.",
      "properties": {
        "Delay": {
          "description": "Amount of time between rollback iterations, in nanoseconds.\n",
          "format": "int64",
          "type": "integer"
        },
        "FailureAction": {
          "description": "Action to take if an rolled back task fails to run, or stops\nrunning during the rollback.\n",
          "enum": [
            "continue",
            "pause"
          ],
          "type": "string"
        },
        "MaxFailureRatio": {
          "default": 0,
          "description": "The fraction of tasks that may fail during a rollback before the\nfailure action is invoked, specified as a floating point number\nbetween 0 and 1.\n",
          "type": "number"
        },
        "Monitor": {
          "description": "Amount of time to monitor each rolled back task for failures, in\nnanoseconds.\n",
          "format": "int64",
          "type": "integer"
        },
        "Order": {
          "description": "The order of operations when rolling back a task. Either the old\ntask is shut down before the new task is started, or the new task\nis started before the old task is shut down.\n",
          "enum": [
            "stop-first",
            "start-first"
          ],
          "type": "string"
        },
        "Parallelism": {
          "description": "Maximum number of tasks to be rolled back in one iteration (0 means\nunlimited parallelism).\n",
          "format": "int64",
          "type": "integer"
        }
      },
      "type": "object"
    },
    "TaskTemplate": {
      "$ref": "#/components/schemas/TaskSpec"
    },
    "UpdateConfig": {
      "description": "Specification for the update strategy of the service.",
      "properties": {
        "Delay": {
          "description": "Amount of time between updates, in nanoseconds.",
          "format": "int64",
          "type": "integer"
        },
        "FailureAction": {
          "description": "Action to take if an updated task fails to run, or stops running\nduring the update.\n",
          "enum": [
            "continue",
            "pause",
            "rollback"
          ],
          "type": "string"
        },
        "MaxFailureRatio": {
          "default": 0,
          "description": "The fraction of tasks that may fail during an update before the\nfailure action is invoked, specified as a floating point number\nbetween 0 and 1.\n",
          "type": "number"
        },
        "Monitor": {
          "description": "Amount of time to monitor each updated task for failures, in\nnanoseconds.\n",
          "format": "int64",
          "type": "integer"
        },
        "Order": {
          "description": "The order of operations when rolling out an updated task. Either\nthe old task is shut down before the new task is started, or the\nnew task is started before the old task is shut down.\n",
          "enum": [
            "stop-first",
            "start-first"
          ],
          "type": "string"
        },
        "Parallelism": {
          "description": "Maximum number of tasks to be updated in one iteration (0 means\nunlimited parallelism).\n",
          "format": "int64",
          "type": "integer"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
```



