v1

latestSwagger 2.02026-07-17107130444.8 KB
Service

Update a service

post/services/{id}/update

Path parameters

idstring required

ID or name of service.

Query parameters

versioninteger required

The version number of the service object being updated. This is required to avoid conflicting writes. This version number should be the value as currently set on the service before the update. You can find the current version by calling GET /services/{id}

registryAuthFrom'spec' | 'previous-spec'

If the X-Registry-Auth header is not specified, this parameter indicates where to find registry authorization credentials.

rollbackstring

Set to this parameter to previous to cause a server-side rollback to the previous service spec. The supplied spec will be ignored in this case.

Headers

X-Registry-Authstring

A base64url-encoded auth configuration for pulling from private registries.

Refer to the authentication section for details.

Request body

Namestring

Name of the service.

Labelsobject

User-defined key/value metadata.

Example request

{
  "Name": "top",
  "TaskTemplate": {
    "ContainerSpec": {
      "Image": "busybox",
      "Args": [
        "top"
      ],
      "OomScoreAdj": 0
    },
    "Resources": {
      "Limits": {},
      "Reservations": {}
    },
    "RestartPolicy": {
      "Condition": "any",
      "MaxAttempts": 0
    },
    "Placement": {},
    "ForceUpdate": 0
  },
  "Mode": {
    "Replicated": {
      "Replicas": 1
    }
  },
  "UpdateConfig": {
    "Parallelism": 2,
    "Delay": 1000000000,
    "FailureAction": "pause",
    "Monitor": 15000000000,
    "MaxFailureRatio": 0.15
  },
  "RollbackConfig": {
    "Parallelism": 1,
    "Delay": 1000000000,
    "FailureAction": "pause",
    "Monitor": 15000000000,
    "MaxFailureRatio": 0.15
  },
  "EndpointSpec": {
    "Mode": "vip"
  }
}

Response

no error

Warningsstring[]

Optional warning messages

Example response

{
  "Warnings": [
    "unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found"
  ]
}