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

# 컨테이너

> 컨테이너 정의, 관찰된 컨테이너 상태 및 컨테이너별 권한.

<h2 id="container">
  Container
</h2>

Source: [src/cwsandbox/\_types.py:1181](https://github.com/coreweave/cwsandbox-client/blob/v1.14.2/src/cwsandbox/_types.py#L1181)

```python theme={"system"}
class Container(*, image: str, name: str | None = None, command: str | None = None, args: Sequence[str] | None = None, environment_variables: Mapping[str, str] | None = None, resources: ResourceOptions | dict[str, Any] | None = None, mounted_files: Sequence[Mapping[str, Any]] | None = None, volume_mounts: Sequence[VolumeMount | Mapping[str, Any]] | None = None, secrets: Sequence[Secret | Mapping[str, Any]] | None = None, working_dir: str | None = None, image_pull_credentials: ImagePullCredentials | Mapping[str, Any] | None = None, primary: bool = False)
```

샌드박스 내 사용자 컨테이너 하나입니다.

`Sandbox.run(containers=[...])`에 목록을 전달하세요. 이 형식은 단일 컨테이너 kwargs (`container_image`,
`command`/`args`, `resources`, `mounted_files`, `secrets`,
`image_pull_credentials`, `environment_variables`,
`security_context`, `working_dir`)와 함께 사용할 수 없으며,
`SandboxDefaults`에서 이러한
필드를 상속하지 않습니다.

컨테이너가 하나인 경우: `primary`를 생략하거나 False로 설정할 수 있습니다(해당 행이 기본 컨테이너입니다).
컨테이너가 여러 개인 경우: 정확히 하나의 행에 `primary=True`를 설정해야 하며, 모든 행에
name과 리소스가 필요합니다. GPU는 기본 컨테이너에서만 허용됩니다.

**속성**

* `name` (`str | None`) : DNS-1123 레이블입니다. 단일 컨테이너에서는 선택이며,
  여러 컨테이너를 지정할 때는 Required입니다.
* `command` (`str | None`) : 진입점입니다. 빈 값/None이면 이미지 진입점을 사용합니다. command 없이도 인수를
  설정할 수 있습니다.
* `args` (`Sequence[str] | None`) : command 또는 이미지 진입점에 전달할 인수입니다.
* `environment_variables` (`Mapping[str, str] | None`) : 이 컨테이너에만 주입되는 환경 변수입니다.
* `resources` (`ResourceOptions | dict[str, Any] | None`) : 이 컨테이너의 CPU/메모리/GPU입니다. 여러
  컨테이너를 지정할 때는 Required입니다.
* `mounted_files` (`Sequence[Mapping[str, Any]] | None`) : 시작 시 이 컨테이너에 기록되는 파일입니다.
* `volume_mounts` (`Sequence[VolumeMount | Mapping[str, Any]] | None`) : 이 컨테이너에 마운트할 샌드박스 수준 볼륨입니다.
* `secrets` (`Sequence[Secret | Mapping[str, Any]] | None`) : 이 컨테이너에만 주입되는 시크릿 저장소의 값입니다.
* `working_dir` (`str | None`) : command의 작업 디렉터리입니다. 설정 시 절대 경로여야
  합니다.
* `image_pull_credentials` (`ImagePullCredentials | Mapping[str, Any] | None`) : 비공개 레지스트리에서 이미지를 가져오기 위한 자격 증명입니다.
* `primary` (`bool`) : True이면 이 컨테이너가 샌드박스 라이프사이클을 관리하며,
  기본 exec/logs/files 대상이 됩니다. Default: `False`.

***

<h2 id="containerstatus">
  ContainerStatus
</h2>

Source: [src/cwsandbox/\_sandbox.py:335](https://github.com/coreweave/cwsandbox-client/blob/v1.14.2/src/cwsandbox/_sandbox.py#L335)

```python theme={"system"}
class ContainerStatus(*, name: str, state: SandboxStatus, exit_code: int | None = None, restart_count: int = 0)
```

샌드박스에서 하나의 컨테이너의 관찰된 상태.

샌드박스 `status` / `returncode`는 primary-owned 상태로 유지됩니다. 이 행은 해당 이름의 컨테이너에 대한 kubelet의 뷰입니다.

**속성**

* `exit_code` (`int | None`) : 컨테이너가 종료 상태에 도달한 후의 종료 코드.
  컨테이너가 아직 실행 중인 동안에는 None입니다.
* `restart_count` (`int`) : 컨테이너가 재시작된 횟수. 기본값: `0`.

***

<h2 id="securitycontext">
  SecurityContext
</h2>

Source: [src/cwsandbox/\_types.py:993](https://github.com/coreweave/cwsandbox-client/blob/v1.14.2/src/cwsandbox/_types.py#L993)

```python theme={"system"}
class SecurityContext(*, run_as_user: int | None = None, run_as_group: int | None = None, privileged: bool | None = None, allow_privilege_escalation: bool | None = None, read_only_root_filesystem: bool | None = None, capabilities_add: Sequence[str] | None = None, capabilities_drop: Sequence[str] | None = None, seccomp_profile: str | None = None)
```

runner policy에 의해 제한되는 인-게스트 컨테이너 권한.

호스트에 도달하는 설정(host network, host PID, hostPath)은 여기에서 표현할 수 없습니다. `privileged`, capabilities, run-as, seccomp은 샌드박스 격리 경계 내에서 적용됩니다.

**속성**

* `run_as_user` (`int | None`) : 진입점의 UID. 설정되지 않으면 이미지 사용자를 사용합니다.
* `run_as_group` (`int | None`) : 진입점의 GID. 설정되지 않으면 이미지 그룹을 사용합니다.
* `privileged` (`bool | None`) : 격리 경계 내에서 권한 있는 상태로 실행합니다.
* `allow_privilege_escalation` (`bool | None`) : 프로세스가 부모보다 더 많은 권한을 얻을 수 있도록 허용합니다.
* `read_only_root_filesystem` (`bool | None`) : 컨테이너 루트 파일 시스템을 읽기 전용으로 마운트합니다.
* `capabilities_add` (`Sequence[str] | None`) : 추가할 Linux capability(예: `"SYS_PTRACE"`).
* `capabilities_drop` (`Sequence[str] | None`) : 삭제할 Linux capability.
* `seccomp_profile` (`str | None`) : `"RuntimeDefault"` 또는 `"Unconfined"`.

***

<h2 id="imagepullcredentials">
  ImagePullCredentials
</h2>

소스: [src/cwsandbox/\_types.py:912](https://github.com/coreweave/cwsandbox-client/blob/v1.14.2/src/cwsandbox/_types.py#L912)

```python theme={"system"}
class ImagePullCredentials(*, registry: str, store: str, name: str, field: str = '')
```

비공개 레지스트리에서 이미지를 가져오기 위한 자격 증명을 시크릿 저장소에서 가져온 것입니다.

**속성**

* `field` (`str`) : 선택 구조화된 시크릿 필드. Default: `''`.

***
