---
title: "Create a Container"
method: POST
path: "/containers"
tags: ["containers"]
---

# Create a Container

`POST /containers`

This operation submits a request to create a Container based on the input parameters.

## Request body

- ContainerIntentInput — An intentful representation of a container
  - `spec` Container, required — Container Entity Definition.
    - `name` string — Container name.
    - `resources` ContainerResources, required — Container Resources Definition.
      - `container_state` string — Desired state of the container.
      - `container_options` ContainerOptions — Container options required to run the container.
        - `network_port_bindings` unknown
        - `volume_mount_map` unknown
        - `container_runtime` string — Name of container runtime.
        - `container_additional_options` string — Additional options to be used for container.
        - `num_cpu_shares` integer — Number of cpu shares.
        - `environments` unknown
        - `command` string — Command to be executed in the container.
        - `restart_policy` string — Container restart policy.
        - `memory_mib` integer — Memory in MiBs.
      - `registry_reference` DockerRegistryReference — The reference to a docker_registry
        - `kind` string, required — The kind name
        - `name` string
        - `uuid` string, UUID, required
      - `subnet_reference_list` SubnetReference[] — Networks associated with this container.
        - `kind` string, required — The kind name
        - `name` string
        - `uuid` string, UUID, required
      - `volume_reference_list` VolumeGroupReference[] — Referenced volumes associated with this container.
        - `kind` string, required — The kind name
        - `name` string
        - `uuid` string, UUID, required
      - `image_name` string, required — Image name to be used for container.
      - `volume_list` VolumeGroup[] — Volumes associated with this container.
        - `name` string, required — Volume group name.
        - `resources` VolumeGroupResources, required — Volume group resources.
          - `flash_mode` string — Flash Mode, if enabled all volume disks of the VG will be pinned to SSD tier.
          - `iscsi_target_name` string — iSCSI target full name
          - `file_system_type` string — File system to be used for volume
          - `size_bytes` integer — The total size of the Volume Group in bytes
          - `sharing_status` string — Whether the volume group can be shared across multiple iSCSI initiators.
          - `attachment_list` AttachmentReference[] — VMs attached to volume group.
            - `vm_reference` Reference — Reference to a kind
              - …
            - `iscsi_initiator_name` string — Name of the iSCSI initiator of the workload outside Nutanix cluster.
          - `disk_list` VolumeDiskResource[] — Volume group disk specification.
            - `index` integer — Index of the volume disk in the group.
            - `data_source_reference` Reference — Reference to a kind
              - …
            - `disk_size_mib` integer — Size of the disk in MiB.
            - `disk_size_bytes` integer — Size of the disk in Bytes.
            - `storage_container_uuid` string, UUID — Container UUID on which to create the disk.
          - `size_mib` integer — The total size of the Volume Group in mib
          - `iscsi_target_prefix` string — iSCSI target prefix-name.
        - `description` string — Volume group description.
  - `api_version` string
  - `metadata` ContainerMetadata, required — The container kind metadata
    - `last_update_time` string, date-time — UTC date and time in RFC-3339 format when container was last updated
    - `kind` string, required — The kind name
    - `uuid` string, UUID — container uuid
    - `spec_version` integer — Version number of the latest spec.
    - `creation_time` string, date-time — UTC date and time in RFC-3339 format when container was created
    - `spec_hash` string — Hash of the spec. This will be returned from server.
    - `should_force_translate` boolean — Applied on Prism Central only. Indicate whether force to translate the spec of the fanout request to fit the target cluster API schema.
    - `owner_reference` UserReference — The reference to a user
      - `kind` string, required — The kind name
      - `name` string
      - `uuid` string, UUID, required
    - `categories` object — Categories for the container
    - `name` string — container name

## Response `202`

Request Accepted

- ContainerIntentResponse — Response object for intentful operations on a container
  - `status` ContainerDefStatus — Container Status Definition.
    - `state` string — State of the container.
    - `message_list` MessageResource[]
      - `message` string, required — If state is ERROR, a message describing the error.
      - `reason` string, required — If state is ERROR, a machine-readable snake-cased string.
      - `details` object — Custom key-value details relevant to the status.
    - `name` string, required — Container name.
    - `resources` ContainerResourcesDefStatus, required — Container Resources Status Definition.
      - `registry_reference` DockerRegistryReference — The reference to a docker_registry
        - `kind` string, required — The kind name
        - `name` string
        - `uuid` string, UUID, required
      - `image_name` string, required — Image name used for container.
      - `volume_list` VolumeGroupDefStatus[] — Volumes associated with this container.
        - `state` string — The state of the volume group entity.
        - `message_list` MessageResource[]
          - `message` string, required — If state is ERROR, a message describing the error.
          - `reason` string, required — If state is ERROR, a machine-readable snake-cased string.
          - `details` object — Custom key-value details relevant to the status.
        - `name` string, required — Volume group name.
        - `resources` VolumeGroupResources, required — Volume group resources.
          - `flash_mode` string — Flash Mode, if enabled all volume disks of the VG will be pinned to SSD tier.
          - `iscsi_target_name` string — iSCSI target full name
          - `file_system_type` string — File system to be used for volume
          - `size_bytes` integer — The total size of the Volume Group in bytes
          - `sharing_status` string — Whether the volume group can be shared across multiple iSCSI initiators.
          - `attachment_list` AttachmentReference[] — VMs attached to volume group.
            - `vm_reference` Reference — Reference to a kind
              - …
            - `iscsi_initiator_name` string — Name of the iSCSI initiator of the workload outside Nutanix cluster.
          - `disk_list` VolumeDiskResource[] — Volume group disk specification.
            - `index` integer — Index of the volume disk in the group.
            - `data_source_reference` Reference — Reference to a kind
              - …
            - `disk_size_mib` integer — Size of the disk in MiB.
            - `disk_size_bytes` integer — Size of the disk in Bytes.
            - `storage_container_uuid` string, UUID — Container UUID on which to create the disk.
          - `size_mib` integer — The total size of the Volume Group in mib
          - `iscsi_target_prefix` string — iSCSI target prefix-name.
        - `description` string — Volume group description.
      - `container_state` string — Current state of the Container.
      - `runtime_name` string — Name of container given by runtime.
      - `container_options` ContainerOptionsStatus — Container options in use by the container
        - `network_port_bindings` unknown
        - `volume_mount_map` unknown
        - `container_runtime` string — Name of container runtime.
        - `container_additional_options` string — Additional options to be used for container.
        - `num_cpu_shares` integer — Number of cpu shares.
        - `environments` unknown
        - `command` string — Command to be executed for the container.
        - `restart_policy` string — Container restart policy.
        - `memory_mib` integer — Memory in MiBs.
      - `subnet_reference_list` SubnetReference[] — Networks associated with this container.
        - `kind` string, required — The kind name
        - `name` string
        - `uuid` string, UUID, required
      - `volume_reference_list` VolumeGroupReference[] — Referenced Volumes associated with this container.
        - `kind` string, required — The kind name
        - `name` string
        - `uuid` string, UUID, required
  - `spec` Container — Container Entity Definition.
    - `name` string — Container name.
    - `resources` ContainerResources, required — Container Resources Definition.
      - `container_state` string — Desired state of the container.
      - `container_options` ContainerOptions — Container options required to run the container.
        - `network_port_bindings` unknown
        - `volume_mount_map` unknown
        - `container_runtime` string — Name of container runtime.
        - `container_additional_options` string — Additional options to be used for container.
        - `num_cpu_shares` integer — Number of cpu shares.
        - `environments` unknown
        - `command` string — Command to be executed in the container.
        - `restart_policy` string — Container restart policy.
        - `memory_mib` integer — Memory in MiBs.
      - `registry_reference` DockerRegistryReference — The reference to a docker_registry
        - `kind` string, required — The kind name
        - `name` string
        - `uuid` string, UUID, required
      - `subnet_reference_list` SubnetReference[] — Networks associated with this container.
        - `kind` string, required — The kind name
        - `name` string
        - `uuid` string, UUID, required
      - `volume_reference_list` VolumeGroupReference[] — Referenced volumes associated with this container.
        - `kind` string, required — The kind name
        - `name` string
        - `uuid` string, UUID, required
      - `image_name` string, required — Image name to be used for container.
      - `volume_list` VolumeGroup[] — Volumes associated with this container.
        - `name` string, required — Volume group name.
        - `resources` VolumeGroupResources, required — Volume group resources.
          - `flash_mode` string — Flash Mode, if enabled all volume disks of the VG will be pinned to SSD tier.
          - `iscsi_target_name` string — iSCSI target full name
          - `file_system_type` string — File system to be used for volume
          - `size_bytes` integer — The total size of the Volume Group in bytes
          - `sharing_status` string — Whether the volume group can be shared across multiple iSCSI initiators.
          - `attachment_list` AttachmentReference[] — VMs attached to volume group.
            - `vm_reference` Reference — Reference to a kind
              - …
            - `iscsi_initiator_name` string — Name of the iSCSI initiator of the workload outside Nutanix cluster.
          - `disk_list` VolumeDiskResource[] — Volume group disk specification.
            - `index` integer — Index of the volume disk in the group.
            - `data_source_reference` Reference — Reference to a kind
              - …
            - `disk_size_mib` integer — Size of the disk in MiB.
            - `disk_size_bytes` integer — Size of the disk in Bytes.
            - `storage_container_uuid` string, UUID — Container UUID on which to create the disk.
          - `size_mib` integer — The total size of the Volume Group in mib
          - `iscsi_target_prefix` string — iSCSI target prefix-name.
        - `description` string — Volume group description.
  - `api_version` string, required
  - `metadata` ContainerMetadata, required — The container kind metadata
    - `last_update_time` string, date-time — UTC date and time in RFC-3339 format when container was last updated
    - `kind` string, required — The kind name
    - `uuid` string, UUID — container uuid
    - `spec_version` integer — Version number of the latest spec.
    - `creation_time` string, date-time — UTC date and time in RFC-3339 format when container was created
    - `spec_hash` string — Hash of the spec. This will be returned from server.
    - `should_force_translate` boolean — Applied on Prism Central only. Indicate whether force to translate the spec of the fanout request to fit the target cluster API schema.
    - `owner_reference` UserReference — The reference to a user
      - `kind` string, required — The kind name
      - `name` string
      - `uuid` string, UUID, required
    - `categories` object — Categories for the container
    - `name` string — container name

## Other responses

- `default` — Internal Error

---

[API](https://skmtc.net/nutanix/apis/nutanix-intentful-api.md) · [All operations](https://skmtc.net/nutanix/apis/nutanix-intentful-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/nutanix/nutanix-intentful-api/revisions/40395083ab31/schema)
