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

# Build a Custom Docker Image

> Uploads a build context (a ZIP with a Dockerfile at its root) and builds it into a registry-hosted image. Poll GET /custom-images/{image_id} or stream GET /custom-images/{image_id}/logs to watch the build.



## OpenAPI

````yaml /api-reference/openapi.json post /custom-images
openapi: 3.0.0
info:
  title: Shard Cloud API
  description: >-
    API reference for Shard Cloud's authenticated management endpoints — Apps,
    Databases, VMs, Custom Docker Images, and project-level Alerts & Backups.
    Every endpoint on this page requires a JWT bearer token (see Authentication
    below). CDN endpoints have their own reference under the CDN tab.
  version: 2.0.0
servers:
  - url: https://shardcloud.app/api
    description: API base path
security: []
tags:
  - name: Databases
    description: PostgreSQL, MySQL, MongoDB, and Redis database services.
  - name: Apps
    description: Web application deployment, files, domains, and configuration.
  - name: VMs
    description: Full Linux virtual machines with SSH access.
  - name: Custom Images
    description: User-built Docker images, deployable straight to an App.
  - name: Project
    description: >-
      Resource alerts and backups — shared across App, Database, and VM
      projects.
paths:
  /custom-images:
    post:
      tags:
        - Custom Images
      summary: Build a Custom Docker Image
      description: >-
        Uploads a build context (a ZIP with a Dockerfile at its root) and builds
        it into a registry-hosted image. Poll GET /custom-images/{image_id} or
        stream GET /custom-images/{image_id}/logs to watch the build.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - context
              properties:
                context:
                  type: string
                  format: binary
                  description: ZIP build context containing a Dockerfile (max 100MB)
                name:
                  type: string
      responses:
        '201':
          description: Build started — image record with status "building"
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomImage'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No valid subscription
      security:
        - JWTAuth: []
components:
  schemas:
    CustomImage:
      type: object
      properties:
        id:
          type: string
          format: uuid
        user_id:
          type: string
          format: uuid
        name:
          type: string
        status:
          type: string
          enum:
            - building
            - success
            - failed
        error:
          type: string
        digest:
          type: string
        uncompressed_bytes:
          type: integer
          format: int64
        layer_count:
          type: integer
        apps:
          type: array
          items:
            $ref: '#/components/schemas/CustomImageApp'
          description: Every app currently deployed from this image.
        github_linked:
          type: boolean
          description: >-
            Whether this image has a GitHub repo linked for auto-rebuild on
            push.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: string
    CustomImageApp:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
  securitySchemes:
    JWTAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Send your API token (Dashboard → Settings → API Token) as
        `Authorization: Bearer <token>`.

````