Create Container

On This Page

Description

Creates a new container.

You must provide a name for the new container (see the name request-data parameter). This name will be used to identify your container in the dashboard.

Request

Request Header

Syntax

    POST /api/containers HTTP/1.1
    Host: <management-APIs URL>
    Content-Type: application/json
    Cookie: session=<cookie>

    url = "<management-APIs URL>/api/containers"
    headers = {
                "Content-Type": "application/json",
                "Cookie": "session=<cookie>"
              }

    HTTP Method

    POST

    URL Resource Parameters

    None

    Request Data

    Syntax

      {
          "data": {
              "attributes":
              {
                  "name":         "string",
                  "description":  "string"
              },
              "type": "container"
          }
      }

      payload = {
                  "data": {
                      "attributes": {
                          "name":         "string",
                          "description":  "string"
                      }
                  }
                  "type": "container"
                }

      Parameters
      attributes

      Container attributes.

      • Type: A JSON object of container attributes
      • Requirement: Required

      The following container attributes are applicable to this request:

      name
      A unique name for the new container. See Container Names and IDs, and specifically Container-Name Restrictions.

      • Type: String
      • Requirement: Required
      description
      A textual description of the container. When provided, this description is displayed in the dashboard together with the container name.

      • Type: String

      • Requirement: Required

      type
      The type of the data object. This value must be set to “container”.

      • Type: String
      • Requirement: Required

      Response

      Response Header

      Syntax
      HTTP/1.1 <status code; 200 on success> <reason phrase>
      Content-Type: application/json
      ...

      Response Data

      Syntax
      {
          "data": {
              "attributes": {
                  "admin_status": "string",
                  "cost":         number,
                  "created_at":   "string",
                  "data_lifecycle_layers_order":  [],
                  "data_policy_layers_order":     [],
                  "id":           number,
                  "imports":      [],
                  "mapping": {
                      "cmds_index":   number,
                      "container_id": number,
                      "mds_instances": [
                          {
                              "service_context": {
                                  "internal_xio_addresses": [
                                      {
                                          "url": "string"
                                      }
                                  ],
                                  "rest_addresses": [
                                      {
                                          "url": "string"
                                      }
                                  ],
                                  "shared_memory_objects": [
                                      {
                                          "address":  "string",
                                          "type":     "string"
                                      }
                                  ],
                                  "shutdown": {
                                      "phase":    number,
                                      "timeout":  number
                                  },
                                  "version_info": {
                                      "external": "string",
                                      "git":      "string ",
                                      "offline":  "string "
                                  },
                                  "xio_addresses": [
                                      {
                                          "url":  "string"
                                      }
                                  ]
                              },
                              "service_id": {
                                  "node_name":        "string",
                                  "service_instance": number,
                                  "service_name":     "string"
                              }
                          }
                      ],
                      "num_slices": 0
                  },
                  "name":               "string",
                  "operational_status": "string",
                  "properties":         [],
                  "updated_at":         "string"
              },
              "id":   number,
              "type": "container"
          },
          ...
      }
      Elements

      The data object in the HTTP response body contains information about the new container, including its name (name), ID (id), creation time (created_at), relevant addresses, and version information (version_info). Full the full list of returned data elements, see response-data syntax above.

      Examples

      Create a container named “mycontainer” with the description “My first container”. The ID of the created container in this example (as returned in the response) is 1030:

      Request

        POST /api/containers HTTP/1.1
        Host: https://dashboard.default-tenant.app.mycluster.iguazio.com
        Content-Type: application/json
        Cookie: session=j%3A%7B%22sid%22%3A%20%22a9ce242a-670f-47a8-9c8b-c6730f2794dc%22%7D
        {
            "data": {
                "attributes":
                {
                    "name":         "mycontainer",
                    "description":  "My first container"
                },
                "type": "container"
            }
        }

        import requests
        
        url = "https://dashboard.default-tenant.app.mycluster.iguazio.com/api/containers"
        headers = {
                    "Content-Type": "application/json",
                    "Cookie": "session=j%3A%7B%22sid%22%3A%20%22a9ce242a-670f-47a8-9c8b-c6730f2794dc%22%7D"
                  }
        payload = {
                    "data": {
                        "attributes": {
                            "name":         "mycontainer",
                            "description":  "My first container"
                        }
                    }
                    "type": "container"
                  }
        response = requests.post(url, json=payload, headers=headers)
        print(response.text)

        Response
        HTTP/1.1 200 OK
        Content-Type: application/json
        ...
        {
            "data": {
                "attributes": {
                    "admin_status": "up",
                    "cost": 0.976715087890625,
                    "created_at": "2018-01-15T08:17:19.904000+00:00",
                    "data_lifecycle_layers_order": [],
                    "data_policy_layers_order": [],
                    "id": 1030,
                    "imports": [],
                    "mapping": {
                        "cmds_index": 0,
                        "container_id": 0,
                        "mds_instances": [
                            {
                                "service_context": {
                                    "internal_xio_addresses": [
                                        {
                                            "url": "tcp:// 10.0.0.1:5000"
                                        }
                                    ],
                                    "rest_addresses": [
                                        {
                                            "url": "10.0.0.1:8154"
                                        }
                                    ],
                                    "shared_memory_objects": [
                                        {
                                            "address": "/dev/shm/mds.1_stats_metadata",
                                            "type": "statsMetadata"
                                        },
                                        {
                                            "address": "/dev/shm/mds.1_stats_values",
                                            "type": "statsValues"
                                        },
                                        {
                                            "address": "place_holder_for_log_shm",
                                            "type": "log"
                                        },
                                        {
                                            "address": "/dev/shm/mds.1_stats_names",
                                            "type": "statsMetricNames"
                                        }
                                    ],
                                    "shutdown": {
                                        "phase": 0,
                                        "timeout": 0
                                    },
                                    "version_info": {
                                        "external": "",
                                        "git": "",
                                        "offline": ""
                                    },
                                    "xio_addresses": [
                                        {
                                            "url": "tcp:// 10.0.0.1:5001"
                                        }
                                    ]
                                },
                                "service_id": {
                                    "node_name": "igz0",
                                    "service_instance": 1,
                                    "service_name": "mds"
                                }
                            }
                        ],
                        "num_slices": 0
                    },
                    "name": "mycontainer",
                    "operational_status": "up",
                    "properties": [],
                    "updated_at": "2018-01-30T14:30:00.367000+00:00"
                },
                "id": 1030,
                "type": "container"
            },
            ...
        }