DOCKER_CLIENT
Main facade for all Docker operations. Communicates with Docker Engine via named pipes.
Creation
make
Create client and connect to Docker daemon.
Postconditions
connection_attempted: True
Connection Queries
| Feature | Return Type | Description |
|---|---|---|
ping | BOOLEAN | Check if Docker daemon is responsive |
version | SIMPLE_JSON_OBJECT | Get Docker version information |
info | SIMPLE_JSON_OBJECT | Get Docker system information |
is_connected | BOOLEAN | Is client connected to daemon? |
Container Operations
| Feature | Parameters | Return | Description |
|---|---|---|---|
list_containers |
a_all: BOOLEAN | ARRAYED_LIST [DOCKER_CONTAINER] | List containers. If a_all is True, includes stopped containers. |
get_container |
a_id: STRING | DOCKER_CONTAINER | Get container by ID or name. |
create_container |
a_spec: CONTAINER_SPEC | DOCKER_CONTAINER | Create container from specification. |
run_container |
a_spec: CONTAINER_SPEC | DOCKER_CONTAINER | Create and start container. |
start_container |
a_id: STRING | BOOLEAN | Start a stopped container. |
stop_container |
a_id: STRING; a_timeout: INTEGER | BOOLEAN | Stop container with timeout in seconds. |
restart_container |
a_id: STRING; a_timeout: INTEGER | BOOLEAN | Restart container. |
pause_container |
a_id: STRING | BOOLEAN | Pause container. |
unpause_container |
a_id: STRING | BOOLEAN | Unpause container. |
kill_container |
a_id: STRING | BOOLEAN | Kill container (SIGKILL). |
remove_container |
a_id: STRING; a_force: BOOLEAN | BOOLEAN | Remove container. Force removes running containers. |
container_logs |
a_id: STRING; a_stdout, a_stderr: BOOLEAN; a_tail: INTEGER | STRING | Get container logs. Tail specifies line count. |
wait_container |
a_id: STRING | INTEGER | Wait for container to exit. Returns exit code. |
Image Operations
| Feature | Parameters | Return | Description |
|---|---|---|---|
list_images |
- | ARRAYED_LIST [DOCKER_IMAGE] | List all local images. |
get_image |
a_name: STRING | DOCKER_IMAGE | Get image by name or ID. |
image_exists |
a_name: STRING | BOOLEAN | Check if image exists locally. |
pull_image |
a_name: STRING | BOOLEAN | Pull image from registry. |
remove_image |
a_name: STRING; a_force: BOOLEAN | BOOLEAN | Remove image. Force removes even if in use. |
Network Operations
| Feature | Parameters | Return | Description |
|---|---|---|---|
list_networks |
- | ARRAYED_LIST [DOCKER_NETWORK] | List all networks. |
get_network |
a_id: STRING | DOCKER_NETWORK | Get network by ID or name. |
create_network |
a_name, a_driver: STRING | DOCKER_NETWORK | Create network with driver. |
remove_network |
a_id: STRING | BOOLEAN | Remove network. |
connect_container_to_network |
a_network_id, a_container_id: STRING | BOOLEAN | Connect container to network. |
disconnect_container_from_network |
a_network_id, a_container_id: STRING; a_force: BOOLEAN | BOOLEAN | Disconnect container from network. |
prune_networks |
- | INTEGER | Remove unused networks. Returns count. |
Volume Operations
| Feature | Parameters | Return | Description |
|---|---|---|---|
list_volumes |
- | ARRAYED_LIST [DOCKER_VOLUME] | List all volumes. |
get_volume |
a_name: STRING | DOCKER_VOLUME | Get volume by name. |
create_volume |
a_name: STRING | DOCKER_VOLUME | Create volume with local driver. |
create_volume_with_driver |
a_name, a_driver: STRING | DOCKER_VOLUME | Create volume with specific driver. |
remove_volume |
a_name: STRING; a_force: BOOLEAN | BOOLEAN | Remove volume. |
prune_volumes |
- | INTEGER | Remove unused volumes. Returns count. |
Exec Operations
| Feature | Parameters | Return | Description |
|---|---|---|---|
exec_in_container |
a_container_id: STRING; a_command: ARRAY [STRING] | STRING | Execute command and return output. |
create_exec |
a_container_id: STRING; a_command: ARRAY [STRING]; a_attach_stdout, a_attach_stderr: BOOLEAN | STRING | Create exec instance. Returns exec ID. |
start_exec |
a_exec_id: STRING | STRING | Start exec and return output. |
inspect_exec |
a_exec_id: STRING | SIMPLE_JSON_OBJECT | Get exec details including exit code. |
Error Handling
| Feature | Return Type | Description |
|---|---|---|
has_error | BOOLEAN | Did last operation fail? |
last_error | DOCKER_ERROR | Error from last operation (if any). |
CONTAINER_SPEC
Fluent builder for container configuration. All setters return Current for chaining.
Creation
make (a_image: STRING)
Create specification for given image.
Preconditions
image_not_empty: not a_image.is_empty
Postconditions
image_set: image.same_string (a_image)
Basic Configuration
| Feature | Parameter | Description |
|---|---|---|
set_name | a_name: STRING | Container name (must be unique) |
set_hostname | a_hostname: STRING | Container hostname |
set_working_dir | a_dir: STRING | Working directory inside container |
set_user | a_user: STRING | User to run as (user or user:group) |
Command Configuration
| Feature | Parameter | Description |
|---|---|---|
set_cmd | a_cmd: ARRAY [STRING] | Command to run |
set_entrypoint | a_entrypoint: ARRAY [STRING] | Container entrypoint |
Environment
| Feature | Parameters | Description |
|---|---|---|
add_env | a_key, a_value: STRING | Add environment variable |
Port Mapping
| Feature | Parameters | Description |
|---|---|---|
add_port | a_container, a_host: INTEGER | Map TCP port |
add_port_udp | a_container, a_host: INTEGER | Map UDP port |
Volume Mounts
| Feature | Parameters | Description |
|---|---|---|
add_volume | a_host, a_container: STRING | Mount volume read-write |
add_volume_readonly | a_host, a_container: STRING | Mount volume read-only |
Resource Limits
| Feature | Parameter | Description |
|---|---|---|
set_memory_limit | a_bytes: INTEGER_64 | Memory limit in bytes |
set_cpu_shares | a_shares: INTEGER | CPU shares (relative weight) |
Policies
| Feature | Parameter | Values |
|---|---|---|
set_restart_policy | a_policy: STRING | no, always, on-failure, unless-stopped |
set_network_mode | a_mode: STRING | bridge, host, none, container:name |
set_auto_remove | a_auto: BOOLEAN | Remove container on exit |
Terminal
| Feature | Parameter | Description |
|---|---|---|
set_tty | a_tty: BOOLEAN | Allocate pseudo-TTY |
set_stdin_open | a_open: BOOLEAN | Keep STDIN open |
Labels
| Feature | Parameters | Description |
|---|---|---|
add_label | a_key, a_value: STRING | Add metadata label |
Export
| Feature | Return | Description |
|---|---|---|
to_json | SIMPLE_JSON_OBJECT | Export as JSON for Docker API |
DOCKER_CONTAINER
Container representation with state and metadata.
Identification
| Feature | Type | Description |
|---|---|---|
id | STRING | Full container ID (64 hex chars) |
short_id | STRING | Short ID (12 chars) |
name | STRING | Container name (without leading /) |
names | ARRAYED_LIST [STRING] | All container names |
Image Information
| Feature | Type | Description |
|---|---|---|
image | STRING | Image name |
image_id | STRING | Image ID |
command | STRING | Command being run |
State Queries
| Feature | Type | Description |
|---|---|---|
state | STRING | Current state string |
status | STRING | Human-readable status |
is_running | BOOLEAN | Is container running? |
is_paused | BOOLEAN | Is container paused? |
is_exited | BOOLEAN | Has container exited? |
is_dead | BOOLEAN | Is container dead? |
exit_code | INTEGER | Exit code (if exited) |
Transition Queries
| Feature | Type | Description |
|---|---|---|
can_start | BOOLEAN | Can container be started? |
can_stop | BOOLEAN | Can container be stopped? |
has_exited_successfully | BOOLEAN | Exited with code 0? |
Network
| Feature | Type | Description |
|---|---|---|
ip_address | STRING | Container IP address |
ports | ARRAYED_LIST [TUPLE] | Port mappings |
Metadata
| Feature | Type | Description |
|---|---|---|
created_timestamp | INTEGER_64 | Unix timestamp of creation |
labels | ARRAYED_LIST [TUPLE] | Container labels |
DOCKER_IMAGE
Image representation with tags and metadata.
Identification
| Feature | Type | Description |
|---|---|---|
id | STRING | Full image ID |
short_id | STRING | Short ID (12 chars) |
repo_tags | ARRAYED_LIST [STRING] | Repository tags |
repo_digests | ARRAYED_LIST [STRING] | Repository digests |
Tag Queries
| Feature | Type | Description |
|---|---|---|
primary_tag | STRING | First tag or "<none>" |
repository | STRING | Repository name from primary tag |
tag | STRING | Tag from primary tag |
has_tag (a_tag) | BOOLEAN | Does image have this tag? |
matches (a_ref) | BOOLEAN | Match by name, tag, or ID |
Size
| Feature | Type | Description |
|---|---|---|
size | INTEGER_64 | Image size in bytes |
virtual_size | INTEGER_64 | Virtual size in bytes |
size_mb | REAL_64 | Size in megabytes |
Metadata
| Feature | Type | Description |
|---|---|---|
created_timestamp | INTEGER_64 | Unix timestamp of creation |
containers | INTEGER | Number of containers using image |
labels | ARRAYED_LIST [TUPLE] | Image labels |
DOCKER_ERROR
Error representation with classification.
Error Information
| Feature | Type | Description |
|---|---|---|
message | STRING | Error message |
status_code | INTEGER | HTTP status code |
error_type | INTEGER | Error type constant |
Error Type Queries
| Feature | Description |
|---|---|
is_connection_error | Cannot connect to Docker daemon |
is_timeout_error | Operation timed out |
is_not_found | Resource not found (404) |
is_conflict | Conflict error (409) |
is_server_error | Docker daemon error (5xx) |
is_client_error | Client error (4xx) |
is_retryable | Can operation be retried? |
CONTAINER_STATE
State constants and transition queries.
State Constants
| Constant | Value |
|---|---|
created | "created" |
running | "running" |
paused | "paused" |
restarting | "restarting" |
removing | "removing" |
exited | "exited" |
dead | "dead" |
State Queries
| Feature | Description |
|---|---|
is_valid_state (s) | Is s a valid state? |
is_running_state (s) | Is s running or paused? |
is_stopped_state (s) | Is s exited or dead? |
Transition Queries
| Feature | Description |
|---|---|
can_start (s) | Can container in state s be started? |
can_stop (s) | Can container in state s be stopped? |
can_pause (s) | Can container in state s be paused? |
can_remove (s) | Can container in state s be removed? |
DOCKERFILE_BUILDER
Fluent builder for Dockerfile generation. Supports multi-stage builds.
Creation
make (a_base_image: STRING)
Create builder with base image.
make_multi_stage
Create builder for multi-stage builds (no initial FROM).
FROM Instructions
| Feature | Parameters | Description |
|---|---|---|
from_image | a_image: STRING | Add FROM instruction |
from_image_as | a_image, a_stage_name: STRING | FROM with stage name |
Build Instructions
| Feature | Parameters | Description |
|---|---|---|
run | a_command: STRING | RUN instruction (shell form) |
run_exec | a_args: ARRAY [STRING] | RUN instruction (exec form) |
run_multi | a_commands: ARRAY [STRING] | RUN with && chaining |
copy_files | a_src, a_dest: STRING | COPY instruction |
copy_from | a_stage, a_src, a_dest: STRING | COPY --from for multi-stage |
add | a_src, a_dest: STRING | ADD instruction |
workdir | a_dir: STRING | WORKDIR instruction |
Environment and Args
| Feature | Parameters | Description |
|---|---|---|
env | a_key, a_value: STRING | ENV instruction |
arg | a_name: STRING | ARG without default |
arg_default | a_name, a_default: STRING | ARG with default value |
label | a_key, a_value: STRING | LABEL instruction |
Runtime Configuration
| Feature | Parameters | Description |
|---|---|---|
expose | a_port: INTEGER | EXPOSE TCP port |
expose_udp | a_port: INTEGER | EXPOSE UDP port |
cmd | a_args: ARRAY [STRING] | CMD (exec form) |
cmd_shell | a_command: STRING | CMD (shell form) |
entrypoint | a_args: ARRAY [STRING] | ENTRYPOINT (exec form) |
user | a_user: STRING | USER instruction |
volume | a_path: STRING | VOLUME instruction |
healthcheck | a_cmd: STRING | HEALTHCHECK CMD |
Output
| Feature | Return | Description |
|---|---|---|
to_string | STRING | Generate Dockerfile content |
save_to_file | BOOLEAN | Save to file path |
DOCKER_NETWORK
Network representation with configuration and connected containers.
Identification
| Feature | Type | Description |
|---|---|---|
id | STRING | Full network ID |
short_id | STRING | Short ID (12 chars) |
name | STRING | Network name |
driver | STRING | Network driver (bridge, host, overlay) |
scope | STRING | Scope (local, global, swarm) |
IPAM
| Feature | Type | Description |
|---|---|---|
ipam_driver_name | STRING | IPAM driver |
ipam_subnet | STRING | Subnet (e.g., "172.17.0.0/16") |
ipam_gateway | STRING | Gateway (e.g., "172.17.0.1") |
Configuration Flags
| Feature | Type | Description |
|---|---|---|
enable_ipv6 | BOOLEAN | IPv6 enabled? |
is_internal | BOOLEAN | Internal network? |
is_attachable | BOOLEAN | Can attach containers? |
is_ingress | BOOLEAN | Swarm ingress network? |
Containers
| Feature | Type | Description |
|---|---|---|
containers | ARRAYED_LIST [TUPLE] | Connected containers |
container_count | INTEGER | Number of containers |
has_container | BOOLEAN | Is container connected? |
Type Queries
| Feature | Description |
|---|---|
is_bridge | Bridge network? |
is_host | Host network? |
is_overlay | Overlay network? |
is_default | Default Docker network? |
matches | Match by ID, short ID, or name |
DOCKER_VOLUME
Volume representation with driver and mount information.
Identification
| Feature | Type | Description |
|---|---|---|
name | STRING | Volume name |
driver | STRING | Volume driver (local, nfs, etc.) |
mountpoint | STRING | Host mount path |
scope | STRING | Scope (local, global) |
created_at | STRING | Creation timestamp |
Usage
| Feature | Type | Description |
|---|---|---|
size | INTEGER_64 | Size in bytes |
size_mb | REAL_64 | Size in megabytes |
size_gb | REAL_64 | Size in gigabytes |
ref_count | INTEGER | Container references |
Labels and Options
| Feature | Type | Description |
|---|---|---|
labels | ARRAYED_LIST [TUPLE] | Volume labels |
options | ARRAYED_LIST [TUPLE] | Driver options |
has_label | BOOLEAN | Has label with key? |
label_value | STRING | Get label value |
Queries
| Feature | Description |
|---|---|
is_local | Local driver volume? |
is_in_use | Used by any container? |
is_anonymous | Anonymous volume (64-char hex)? |
matches | Match by name |