Service

Update a service

Changed on
post/services/{id}/update

Request

  • Base URL
    /v1.57 (relative, and the document was published on a file host, not at the API’s origin)
  • Auth
    none declared

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"
  ]
}

Changes

    • breaking

      removed the request body

    • breaking

      removed the media type application/json for the response with the status

    • info

      api tag Service added

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • breaking

      the request's body type changed from no type to object

    • breaking

      for the query request parameter registryAuthFrom, default value spec was removed

    • breaking

      for the query request parameter version, the format changed from no format to int32

    • warning

      removed subschema #2 from the request body allOf list

    • info

      api tag Service removed

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      removed the non-success response with the status

    • info

      removed the non-success response with the status

    • info

      removed the non-success response with the status

    • info

      removed the non-success response with the status