Search or ask Docker

Inspect a service

GET /services/{id} — Docker Engine API 1.57.

View Markdown
GET/services/{id}

Connection and access

API connection and authentication guidance

/v1.57

No HTTP authentication requirement is declared for this operation. Transport access controls can still apply.

Parameters

id path Required

ID or name of service.

Type: string

All schema constraints and annotations
{
  "type": "string"
}

insertDefaults query

Fill empty fields with default values.

Type: boolean

All schema constraints and annotations
{
  "default": false,
  "type": "boolean"
}

Request and responses

Response 200

no error

application/json

Schema: Service

Schema example

{
  "CreatedAt": "2016-06-07T21:05:51.880065305Z",
  "Endpoint": {
    "Ports": [
      {
        "Protocol": "tcp",
        "PublishedPort": 30001,
        "TargetPort": 6379
      }
    ],
    "Spec": {
      "Mode": "vip",
      "Ports": [
        {
          "Protocol": "tcp",
          "PublishedPort": 30001,
          "TargetPort": 6379
        }
      ]
    },
    "VirtualIPs": [
      {
        "Addr": "10.255.0.2/16",
        "NetworkID": "4qvuz4ko70xaltuqbt8956gd1"
      },
      {
        "Addr": "10.255.0.3/16",
        "NetworkID": "4qvuz4ko70xaltuqbt8956gd1"
      }
    ]
  },
  "ID": "9mnpnzenvg8p8tdbtq4wvbkcz",
  "Spec": {
    "EndpointSpec": {
      "Mode": "vip",
      "Ports": [
        {
          "Protocol": "tcp",
          "PublishedPort": 30001,
          "TargetPort": 6379
        }
      ]
    },
    "Mode": {
      "Replicated": {
        "Replicas": 1
      }
    },
    "Name": "hopeful_cori",
    "RollbackConfig": {
      "Delay": 1000000000,
      "FailureAction": "pause",
      "MaxFailureRatio": 0.15,
      "Monitor": 15000000000,
      "Parallelism": 1
    },
    "TaskTemplate": {
      "ContainerSpec": {
        "Image": "redis"
      },
      "ForceUpdate": 0,
      "Placement": {},
      "Resources": {
        "Limits": {},
        "Reservations": {}
      },
      "RestartPolicy": {
        "Condition": "any",
        "MaxAttempts": 0
      }
    },
    "UpdateConfig": {
      "Delay": 1000000000,
      "FailureAction": "pause",
      "MaxFailureRatio": 0.15,
      "Monitor": 15000000000,
      "Parallelism": 1
    }
  },
  "UpdatedAt": "2016-06-07T21:07:29.962229872Z",
  "Version": {
    "Index": 19
  }
}

Response 200

no error

text/plain

Schema: Service

Schema example

{
  "CreatedAt": "2016-06-07T21:05:51.880065305Z",
  "Endpoint": {
    "Ports": [
      {
        "Protocol": "tcp",
        "PublishedPort": 30001,
        "TargetPort": 6379
      }
    ],
    "Spec": {
      "Mode": "vip",
      "Ports": [
        {
          "Protocol": "tcp",
          "PublishedPort": 30001,
          "TargetPort": 6379
        }
      ]
    },
    "VirtualIPs": [
      {
        "Addr": "10.255.0.2/16",
        "NetworkID": "4qvuz4ko70xaltuqbt8956gd1"
      },
      {
        "Addr": "10.255.0.3/16",
        "NetworkID": "4qvuz4ko70xaltuqbt8956gd1"
      }
    ]
  },
  "ID": "9mnpnzenvg8p8tdbtq4wvbkcz",
  "Spec": {
    "EndpointSpec": {
      "Mode": "vip",
      "Ports": [
        {
          "Protocol": "tcp",
          "PublishedPort": 30001,
          "TargetPort": 6379
        }
      ]
    },
    "Mode": {
      "Replicated": {
        "Replicas": 1
      }
    },
    "Name": "hopeful_cori",
    "RollbackConfig": {
      "Delay": 1000000000,
      "FailureAction": "pause",
      "MaxFailureRatio": 0.15,
      "Monitor": 15000000000,
      "Parallelism": 1
    },
    "TaskTemplate": {
      "ContainerSpec": {
        "Image": "redis"
      },
      "ForceUpdate": 0,
      "Placement": {},
      "Resources": {
        "Limits": {},
        "Reservations": {}
      },
      "RestartPolicy": {
        "Condition": "any",
        "MaxAttempts": 0
      }
    },
    "UpdateConfig": {
      "Delay": 1000000000,
      "FailureAction": "pause",
      "MaxFailureRatio": 0.15,
      "Monitor": 15000000000,
      "Parallelism": 1
    }
  },
  "UpdatedAt": "2016-06-07T21:07:29.962229872Z",
  "Version": {
    "Index": 19
  }
}

Response 404

no such service

application/json

Schema: ErrorResponse

Schema example

{
  "message": "Something went wrong."
}

Response 500

server error

application/json

Schema: ErrorResponse

Schema example

{
  "message": "Something went wrong."
}

Response 503

node is not part of a swarm

application/json

Schema: ErrorResponse

Schema example

{
  "message": "Something went wrong."
}

Referenced schemas

#/components/schemas/ErrorResponse

#/components/schemas/Service

Complete operation contract
{
  "operationId": "ServiceInspect",
  "parameters": [
    {
      "description": "ID or name of service.",
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "Fill empty fields with default values.",
      "in": "query",
      "name": "insertDefaults",
      "schema": {
        "default": false,
        "type": "boolean"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Service"
          }
        },
        "text/plain": {
          "schema": {
            "$ref": "#/components/schemas/Service"
          }
        }
      },
      "description": "no error"
    },
    "404": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "no such service"
    },
    "500": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "server error"
    },
    "503": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "node is not part of a swarm"
    }
  },
  "summary": "Inspect a service",
  "tags": [
    "Service"
  ]
}