> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gmicloud.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create containers

> create Container under default namespace



## OpenAPI

````yaml /api-spec/service_api.yaml post /v1/containers
openapi: 3.0.1
info:
  contact:
    email: support@gmicloud.ai
  description: Cluster Engine API spec
  title: Cluster Engine API
  version: 2.4.0
servers:
  - url: https://console.gmicloud.ai/api
security:
  - bearerAuth: []
tags:
  - name: containers
    description: >-
      GMI Container management APIs for creating, managing, and monitoring
      containerized applications.
  - name: templates
    description: >-
      GMI template management APIs for creating and managing reusable container
      template.
  - name: baremetals
    description: >-
      GMI Bare metal management APIs for provisioning, configuring, and
      controlling physical server nodes. Handles server lifecycle management,
      hardware inventory, and status monitoring.
  - name: images
    description: GMI Image management APIs for query OS images.
  - name: elastic-ips
    description: >-
      GMI Elastic IP address management APIs for allocating, associating, and
      managing public IP addresses.
paths:
  /v1/containers:
    post:
      tags:
        - containers
      summary: Create containers
      description: create Container under default namespace
      operationId: createContainer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/containerReq'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/UuidObject'
                type: array
          description: successful
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  schemas:
    containerReq:
      allOf:
        - properties:
            count:
              minimum: 1
              type: integer
          required:
            - count
          type: object
        - $ref: '#/components/schemas/container'
    UuidObject:
      properties:
        id:
          format: uuid
          type: string
      required:
        - id
      type: object
    container:
      allOf:
        - properties:
            idc:
              $ref: '#/components/schemas/idcName'
            product:
              $ref: '#/components/schemas/productName'
          required:
            - product
            - idc
          type: object
        - $ref: '#/components/schemas/containerConfig'
    error:
      properties:
        code:
          type: integer
          x-go-type-skip-optional-pointer: true
        reason:
          type: string
          x-go-type-skip-optional-pointer: true
      required:
        - reason
      type: object
    errorStatusMessage:
      example:
        code: 0
        group: request
        validationDetail:
          - expression: required
            field: userName
            originalValue: ''
            reason: This field is required.
      properties:
        code:
          description: The substatus error code for the API response.
          type: integer
        group:
          description: >-
            API function group. Will be "request" if there are invalid request
            parameters.
          type: string
        message:
          description: The substatus error message for the API response.
          type: string
        traces:
          description: The original error messages.
          items:
            type: string
          type: array
        validationDetail:
          items:
            $ref: '#/components/schemas/validationDetail'
          type: array
      required:
        - group
        - code
      type: object
    idcName:
      maxLength: 50
      pattern: ^[a-zA-Z0-9._-]+$
      type: string
    productName:
      maxLength: 256
      pattern: ^[a-zA-Z0-9._-]+$
      type: string
    containerConfig:
      properties:
        args:
          default: []
          description: Optional container command arguments
          items:
            type: string
          type: array
          x-go-type-skip-optional-pointer: true
        command:
          default: ''
          description: Optional container start command
          type: string
          x-go-type-skip-optional-pointer: true
        envs:
          default: []
          example:
            - name: access_token
              value: kalsk113==
          items:
            $ref: '#/components/schemas/Env'
          minLength: 0
          type: array
        name:
          $ref: '#/components/schemas/name'
          example: LLM training
        ports:
          default: []
          items:
            $ref: '#/components/schemas/exposedPort'
          maxLength: 5
          minLength: 0
          type: array
          x-go-type-skip-optional-pointer: true
        sshKeyIdList:
          $ref: '#/components/schemas/UuidList'
          description: The list of SSH key IDs to use in the container
        templateId:
          description: template id
          format: uuid
          type: string
      required:
        - name
        - templateId
      type: object
    validationDetail:
      example:
        expression: required
        field: userName
        originalValue: ''
        reason: This field is required.
      properties:
        argument:
          description: Data supporting the expression.
          type: string
        expression:
          description: The form of violation.
          type: string
        field:
          description: The field of the request data.
          type: string
        originalValue:
          description: The original value from the request.
          type: string
        reason:
          description: The reason for the validation error.
          type: string
      type: object
    Env:
      properties:
        name:
          maxLength: 4096
          pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$
          type: string
        value:
          default: ''
          maxLength: 1048576
          type: string
      required:
        - name
        - value
    name:
      maxLength: 255
      pattern: ^([A-Za-z0-9][A-Za-z0-9_\-. ]*)?[A-Za-z0-9]$
      type: string
    exposedPort:
      properties:
        containerPort:
          maximum: 65534
          minimum: 0
          type: integer
        port:
          maximum: 65534
          minimum: 0
          type: integer
          x-go-type-skip-optional-pointer: true
        protocol:
          enum:
            - TCP
            - UDP
          type: string
      required:
        - containerPort
        - protocol
    UuidList:
      items:
        format: uuid
        type: string
      type: array
  responses:
    BadRequest:
      content:
        application/json:
          example:
            reason: resources.CPU is a required property
          schema:
            oneOf:
              - $ref: '#/components/schemas/error'
              - $ref: '#/components/schemas/errorStatusMessage'
      description: bad request
    Unauthorized:
      content:
        application/json:
          examples:
            Expired access token.:
              summary: Expired access token.
              value:
                code: 1
                group: auth_verify
                message: Expired access token.
            Invalid access token.:
              summary: Invalid access token.
              value:
                code: 0
                group: auth_verify
                message: Invalid access token.
          schema:
            $ref: '#/components/schemas/errorStatusMessage'
      description: Authentication information is missing or invalid
      headers:
        WWW_Authenticate:
          schema:
            type: string
    Forbidden:
      content:
        application/json:
          example:
            reason: 'access denied: tenant has no permission to do the operation'
          schema:
            $ref: '#/components/schemas/error'
      description: tenant has no permission to do the operation
    NotFound:
      content:
        application/json:
          example:
            reason: resource 12345678-1234-2234-3234-xxxxxxxxxxxxxx was not found
          schema:
            $ref: '#/components/schemas/error'
      description: The specified resource was not found
    InternalServerError:
      content:
        application/json:
          example:
            reason: An error occurred in the kubernetes cluster
          schema:
            $ref: '#/components/schemas/error'
      description: Internal Server Error
    ServiceUnavailable:
      content:
        application/json:
          example:
            reason: database is unavailable
          schema:
            $ref: '#/components/schemas/error'
      description: a dependent service is unavailable
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT
      scheme: bearer
      type: http

````