Module command

Module command 

Source
Expand description

Docker command implementations.

This module contains all Docker CLI command wrappers. Each command is implemented as a struct with a builder pattern API.

§The DockerCommand Trait

All commands implement DockerCommand, which provides:

§Example

use docker_wrapper::{DockerCommand, RunCommand};

let container = RunCommand::new("nginx:alpine")
    .name("web")
    .port(8080, 80)
    .detach()
    .execute()
    .await?;

println!("Started container: {}", container.short());

§Extensibility

For options not yet implemented, use the escape hatch methods:

use docker_wrapper::{DockerCommand, RunCommand};

let mut cmd = RunCommand::new("nginx");
cmd.arg("--some-new-flag")
   .args(["--option", "value"]);
cmd.execute().await?;

Modules§

attach
Docker attach command implementation.
bake
Docker Bake Command Implementation
build
Docker build command implementation.
builder
Docker builder and buildx commands
commit
Docker commit command implementation.
compose
Docker Compose command implementations using the unified trait pattern.
container_prune
Docker container prune command implementation.
context
Docker context management commands
cp
Docker cp command implementation.
create
Docker create command implementation.
diff
Docker diff command implementation.
events
Docker events command implementation.
exec
Docker exec command implementation.
export
Docker export command implementation.
generic
Generic Docker command for executing any Docker CLI command.
history
Docker history command implementation.
image_prune
Docker image prune command implementation.
images
Docker Images Command Implementation
import
Docker import command implementation.
info
Docker info command implementation
init
Docker init command implementation
inspect
Docker inspect command implementation.
kill
Docker kill command implementation.
load
Docker load command implementation.
login
Docker login command implementation
logout
Docker logout command implementation
logs
Docker logs command implementation.
manifest
Docker manifest command implementations.
network
Docker network management commands.
pause
Docker pause command implementation.
port
Docker port command implementation.
ps
Docker ps command implementation.
pull
Docker Pull Command Implementation
push
Docker Push Command Implementation
rename
Docker rename command implementation.
restart
Docker restart command implementation.
rm
Docker rm command implementation.
rmi
Docker rmi command implementation.
run
Docker run command implementation.
save
Docker save command implementation.
search
Docker search command implementation
start
Docker start command implementation.
stats
Docker stats command implementation.
stop
Docker stop command implementation.
swarm
Docker Swarm command implementations.
system
Docker system management commands.
tag
Docker tag command implementation.
top
Docker top command implementation.
unpause
Docker unpause command implementation.
update
Docker update command implementation.
version
Docker version command implementation
volume
Docker volume management commands.
wait
Docker wait command implementation.

Structs§

CommandExecutor
Common functionality for executing Docker commands
CommandOutput
Output from executing a Docker command
ComposeConfig
Base configuration for all compose commands
EnvironmentBuilder
Helper for building environment variables
PortBuilder
Helper for building port mappings
PortMapping
Port mapping configuration

Enums§

AnsiMode
ANSI control character mode
ProgressType
Progress output type for compose commands
Protocol
Network protocol for port mappings

Constants§

DEFAULT_COMMAND_TIMEOUT
Default timeout for command execution (30 seconds)

Traits§

ComposeCommand
Extended trait for Docker Compose commands
DockerCommand
Unified trait for all Docker commands (both regular and compose)