Container
Create and manage Docker containers with support for port mappings, volumes, networks, and healthchecks.Properties
Image | RemoteImage | string
required
Image to use for the container. Can be an Alchemy Image or RemoteImage resource or a string image reference.
string
Container name.Default:
${app}-${stage}-${id}string[]
Command to run in the container.
Record<string, string | Secret>
Environment variables for the container.
PortMapping[]
Port mappings between host and container.Each mapping has:
external: Host portinternal: Container portprotocol: “tcp” or “udp” (optional)
VolumeMapping[]
Volume mappings between host and container.Each mapping has:
hostPath: Path on hostcontainerPath: Path in containerreadOnly: Whether volume is read-only (optional)
'no' | 'always' | 'on-failure' | 'unless-stopped'
Restart policy for the container.
NetworkMapping[]
Networks to connect the container to.Each mapping has:
name: Network name or IDaliases: Network aliases (optional)
boolean
Whether to remove the container when it exits.
boolean
Start the container after creation.
HealthcheckConfig
Healthcheck configuration with:
cmd: Command to run (string or array)interval: Time between checks (Duration)timeout: Max time for check (Duration)retries: Consecutive failures neededstartPeriod: Initialization time (Duration)startInterval: Check interval during start (Duration)
boolean
Whether to adopt the container if it already exists.Default:
falseReturns
string
Container ID assigned by Docker.
string
Container name.
'created' | 'running' | 'paused' | 'stopped' | 'exited'
Current state of the container.
number
Timestamp when the container was created.
() => Promise<ContainerRuntimeInfo>
Function to inspect the container and get detailed runtime information including port mappings.
Examples
Create a simple Nginx container
Container with environment and volumes
Container with healthcheck
Image
Build and manage Docker images from Dockerfiles with support for multi-stage builds, build arguments, and registry push.Properties
string
Repository name for the image (e.g., “username/image”).Default: The resource ID
string
Tag for the image (e.g., “latest”).Default:
"latest"DockerBuildOptions
Build configuration with:
context: Build context directorydockerfile: Path to Dockerfileplatform: Target platform (e.g., “linux/amd64”)args: Build argumentstarget: Target build stagecacheFrom: Cache sourcescacheTo: Cache destinationsoptions: Additional Docker build options
string | Image | RemoteImage
Image reference to tag (alternative to build).
ImageRegistry
Registry credentials for pushing:
username: Registry usernamepassword: Registry password (Secret)server: Registry server URL
boolean
Whether to skip pushing the image to registry.Default:
falseReturns
string
Image name.
string
Full image reference (name:tag).
string
Docker image ID.
string
Repository digest if pushed to registry.
number
Timestamp when the image was built.
Examples
Build an image from Dockerfile
Build and push to registry
RemoteImage
Pull and reference Docker images from remote registries.Properties
string
required
Docker image name (e.g., “nginx”).
string
Tag for the image (e.g., “latest” or “1.19-alpine”).Default:
"latest"boolean
Always attempt to pull the image, even if it exists locally.
Returns
string
Full image reference (name:tag).
number
Timestamp when the image was pulled.
Examples
Network
Create and manage Docker networks for container connectivity.Properties
string
Network name.Default:
${app}-${stage}-${id}'bridge' | 'host' | 'none' | 'overlay' | 'macvlan' | string
Network driver to use.Default:
"bridge"boolean
Enable IPv6 on the network.Default:
falseRecord<string, string>
Custom metadata labels for the network.
Returns
string
Network ID assigned by Docker.
string
Network name.
number
Timestamp when the network was created.
Examples
Volume
Create and manage Docker volumes for persistent data storage.Properties
string
Volume name.Default:
${app}-${stage}-${id}string
Volume driver to use.Default:
"local"Record<string, string>
Driver-specific options (e.g., NFS configuration).
VolumeLabel[] | Record<string, string>
Custom metadata labels for the volume.
boolean
Whether to adopt the volume if it already exists.Default:
falseReturns
string
Volume ID (same as name for Docker volumes).
string
Volume name.
string
Volume mountpoint path on the host.
number
Timestamp when the volume was created.