Skip to content

Container Diagram

c4.diagrams.container.ContainerDiagram

Bases: Diagram

Represents a C4 Container diagram.

c4.diagrams.container.Container

Bases: Element

Represents an application or service container in a C4 Container diagram.

A container can be a web application, API, worker, or any executable unit of deployment. It may optionally include technology and shape hints.

__init__

__init__(
    label: str | Required = not_provided,
    description: str = "",
    technology: str = "",
    sprite: str = "",
    tags: str = "",
    link: str = "",
    base_shape: str = "",
    alias: str | EmptyStr = empty,
) -> None

Parameters:

Name Type Description Default
label str | Required

Human-readable name of the container.

not_provided
description str

Optional description of the container's purpose.

''
technology str

The technology stack used by the container.

''
sprite str

Optional sprite identifier for visual representation.

''
tags str

Comma-separated tags for filtering or styling.

''
link str

Optional URL for external documentation or navigation.

''
base_shape str

Optional base shape override for rendering.

''
alias str | EmptyStr

Unique identifier for the container.

empty

c4.diagrams.container.ContainerDb

Bases: ElementWithTechnology

Represents a container specifically modeled as a database.

c4.diagrams.container.ContainerQueue

Bases: ElementWithTechnology

Represents a container modeled as a message queue or event broker.

c4.diagrams.container.ContainerExt

Bases: Container

Represents an external container (outside the system boundary).

c4.diagrams.container.ContainerDbExt

Bases: ContainerDb

Represents an external database container.

c4.diagrams.container.ContainerQueueExt

Bases: ContainerQueue

Represents an external message queue or broker.

c4.diagrams.container.ContainerBoundary

Bases: Boundary

Represents a boundary grouping containers within a system.

__init__

__init__(
    label: str | Required = not_provided,
    description: str = "",
    tags: str = "",
    link: str = "",
    alias: str | EmptyStr = empty,
) -> None

Parameters:

Name Type Description Default
label str | Required

Displayed label of the boundary. Defaults to empty.

not_provided
description str

Optional human-readable description of the boundary.

''
tags str

Optional comma-separated tags for styling or filtering.

''
link str

URL associated with the boundary for navigation or documentation.

''
alias str | EmptyStr

Unique identifier for the boundary.

empty