docker-wrapper
A type-safe Docker CLI wrapper for Rust.
Installation
[]
= "0.10"
= { = "1", = ["full"] }
MSRV: 1.89.0
Quick Start
use ;
async
Note: Import
DockerCommandtrait to use.execute()on commands.
Features
# Docker Compose support
= { = "0.10", = ["compose"] }
# Container templates (Redis, PostgreSQL, etc.)
= { = "0.10", = ["templates"] }
Compose Example
use ;
new
.file
.detach
.execute
.await?;
Templates Example
use ;
let redis = new
.port
.password;
let id = redis.start.await?;
redis.stop.await?;
Why docker-wrapper?
This crate wraps the Docker CLI rather than calling the Docker API directly (like bollard).
| docker-wrapper | bollard | |
|---|---|---|
| Approach | Shells out to docker CLI |
Calls Docker REST API directly |
| Setup | Just needs docker in PATH |
Needs API socket access |
| Compose | Native docker compose support |
Not supported |
| Compatibility | Works with Docker, Podman, Colima, etc. | Docker API only |
| Performance | Process spawn overhead | Direct API calls |
| Use case | CLI tools, scripts, dev tooling | High-performance services |
Choose docker-wrapper when: You're building CLI tools, need Compose support, want to work with Docker alternatives, or are migrating shell scripts to Rust.
Choose bollard when: You need maximum performance, direct API access, or are building a long-running service with many Docker operations.
Documentation
- API Reference - Complete documentation with examples
- Examples - Working code examples
License
MIT OR Apache-2.0