---
title: "Clone container"
method: POST
path: "/container/{containerId}/clone"
tags: ["Containers"]
---

# Clone container

`POST /container/{containerId}/clone`

## Request

- Base URL: `https://api.qovery.com`
- URL: `https://api.qovery.com/container/{containerId}/clone`
- Auth: one of:
  - API key in header `Authorization`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/qovery/apis/qovery-api/docs/container/:containerId/clone/post.ts> (a function with typed inputs; its response is checked against the schema)

This will create a new container with the same configuration on the targeted environment Id.

## Path parameters

- `containerId` string, uuid, required

## Request body

- CloneServiceRequest
  - `name` string, required
  - `environment_id` string, uuid, required

## Response `202`

Container clone has been requested

- ContainerResponse
  - `id` string, uuid, required
  - `created_at` string, date-time, required
  - `updated_at` string, date-time
  - `storage` object[]
    - `id` string, uuid, required
    - `type` 'FAST_SSD', required
    - `size` integer, required: unit is GB
    - `mount_point` string, required
  - `image_name` string, required: The image name pattern differs according to chosen container registry provider: * `ECR`: `repository` * `SCALEWAY_CR`: `namespace/image` * `DOCKER_HUB`: `image` or `repository/image` * `PUBLIC_ECR`: `registry_alias/repository`
  - `tag` string, required: tag of the image container
  - `registry_id` string: tag of the image container
  - `registry` ContainerRegistryProviderDetailsResponse, required
    - `id` string, uuid, required
    - `name` string, required
    - `url` string, required: URL of the container registry
    - `kind` 'ECR' | 'SCALEWAY_CR' | 'DOCKER_HUB' | 'GITHUB_CR' | 'GITHUB_ENTERPRISE_CR' | 'GITLAB_CR' | 'PUBLIC_ECR' | 'DOCR' | 'GENERIC_CR' | 'GCP_ARTIFACT_REGISTRY' | 'AZURE_CR', required: The type of your container registry
  - `environment` ReferenceObject, required
    - `id` string, uuid, required
  - `maximum_cpu` integer, required: Maximum cpu that can be allocated to the container based on organization cluster configuration. unit is millicores (m). 1000m = 1 cpu
  - `maximum_memory` integer, required: Maximum memory that can be allocated to the container based on organization cluster configuration. unit is MB. 1024 MB = 1GB
  - `maximum_gpu` integer, required: Maximum memory that can be allocated to the container based on organization cluster configuration. unit is MB. 1024 MB = 1GB
  - `name` string, required: name is case insensitive
  - `description` string: give a description to this container
  - `arguments` string[]
  - `entrypoint` string: optional entrypoint when launching container
  - `cpu` integer, required: unit is millicores (m). 1000m = 1 cpu
  - `memory` integer, required: unit is MB. 1024 MB = 1GB
  - `gpu` integer, required
  - `min_running_instances` integer, required: Minimum number of instances running. This resource auto-scale based on the CPU and Memory consumption. Note: 0 means that there is no container running.
  - `max_running_instances` integer, required: Maximum number of instances running. This resource auto-scale based on the CPU and Memory consumption. Note: -1 means that there is no limit.
  - `healthchecks` Healthcheck, required
    - `readiness_probe` Probe, nullable
      - `type` object
        - `tcp` object, nullable
          - `port` integer
          - `host` string, nullable
        - `http` object, nullable
          - `path` string
          - `scheme` string
          - `port` integer
        - `exec` object, nullable
          - `command` string[]
        - `grpc` object, nullable
          - `service` string, nullable
          - `port` integer
      - `initial_delay_seconds` integer
      - `period_seconds` integer
      - `timeout_seconds` integer
      - `success_threshold` integer
      - `failure_threshold` integer
    - `liveness_probe` Probe, nullable
      - `type` object
        - `tcp` object, nullable
          - `port` integer
          - `host` string, nullable
        - `http` object, nullable
          - `path` string
          - `scheme` string
          - `port` integer
        - `exec` object, nullable
          - `command` string[]
        - `grpc` object, nullable
          - `service` string, nullable
          - `port` integer
      - `initial_delay_seconds` integer
      - `period_seconds` integer
      - `timeout_seconds` integer
      - `success_threshold` integer
      - `failure_threshold` integer
  - `auto_preview` boolean, required: Indicates if the 'environment preview option' is enabled for this container. If enabled, a preview environment will be automatically cloned when `/preview` endpoint is called. If not specified, it takes the value of the `auto_preview` property from the associated environment.
  - `ports` ServicePort[]
    - `id` string, uuid, required
    - `name` string
    - `internal_port` integer, required: The listening port of your service.
    - `external_port` integer: The exposed port for your service. This is optional. If not set a default port will be used.
    - `publicly_accessible` boolean, required: Expose the port to the world
    - `is_default` boolean: is the default port to use for domain
    - `protocol` 'HTTP' | 'GRPC' | 'TCP' | 'UDP', required
    - `public_path` string: Indicate the path or regex that must match for traffic to be accepted on your service i.e: /api/ will only accept http calls that start with /api/ Only valid for publicly_accessible HTTP or GRPC ports.
    - `public_path_rewrite` string: Indicate the new path that will be used to reach your service after replacement i.e: public_path -> /(.*) public_path_rewrite -> /api/$1 will append /api/ on all externaly requested url when reaching the service external/use url -> example.com/foobar -> url seen by the service -> example.com/api/foobar Only valid for publicly_accessible HTTP or GRPC ports.
  - `auto_deploy` boolean: Specify if the container will be automatically updated after receiving a new image tag. The new image tag shall be communicated via the "Auto Deploy container" endpoint https://api-doc.qovery.com/#tag/Containers/operation/autoDeployContainerEnvironments
  - `annotations_groups` OrganizationAnnotationsGroupResponse[]
    - `id` string, uuid, required
    - `created_at` string, date-time, required
    - `updated_at` string, date-time
    - `name` string, required
    - `annotations` Annotation[], required
      - `key` string, required
      - `value` string, required
    - `scopes` OrganizationAnnotationsGroupScopeEnum[], required
  - `labels_groups` OrganizationLabelsGroupResponse[]
    - `id` string, uuid, required
    - `created_at` string, date-time, required
    - `updated_at` string, date-time
    - `name` string, required
    - `labels` Label[], required
      - `key` string, required
      - `value` string, required
      - `propagate_to_cloud_provider` boolean, required
  - `icon_uri` string, uri, required: Icon URI representing the container.
  - `service_type` 'APPLICATION' | 'DATABASE' | 'CONTAINER' | 'JOB' | 'HELM' | 'TERRAFORM', required: type of the service (application, database, job, ...)

## Other responses

- `401`: Access token is missing or invalid
- `403`: Access forbidden
- `404`: Resource not found
- `409`: Operation is in progress

---

[API](https://skmtc.dev/qovery/apis/qovery-api.md) - [All operations](https://skmtc.dev/qovery/apis/qovery-api/llms.txt) - [OpenAPI document](https://skmtc.dev/qovery/apis/qovery-api/revisions/93c4960a44ba?raw)
