docker2
6.3.0, released 3 weeks ago by onepub.dev
Dart wrapper for Docker CLI to manage images and containers
What it does
Provides a Dart API to pull, build, run, and manage Docker images and containers using the local Docker CLI. It exposes immutable core classes for images, containers, and volumes, and throws exceptions on build failures.
AI-written summary of version 6.3.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to automate Docker tasks from a Dart application
- You want a typed API instead of shelling out to Docker directly
Skip it when
- You don't have Docker installed or cannot run the Docker CLI
- You need cross-platform container orchestration beyond local Docker
Strengths
- Simple API that mirrors Docker CLI commands
- Immutable core classes for safer usage
- Built-in error handling for build failures
Weaknesses
- Requires Docker CLI to be installed and in PATH
- Limited to local Docker, no remote registry support
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
Ensure Docker is installed and accessible via PATH; no build_runner or extra steps needed
```dart
final docker = Docker();
final image = await docker.pull('alpine');
final container = image.create('alpine_sleep', argString: 'sleep infinity');
container.start();
await Future.delayed(Duration(seconds: 2));
container.stop();
container.delete();
```Alternatives
Packages that do the same job and could replace docker2.
- docker_commander
Docker manager for local and remote host machines to automate Docker Daemons and Swarms.
64Compare
Works with
Packages commonly used together with docker2: ones it builds on, ones built on it, and its own family.
- argsdocker2 depends on itLibrary for parsing raw command-line arguments into options and values using GNU and POSIX styles.
- dclidocker2 depends on itA Dart SDK for building cross‑platform command line applications and scripts.
- pub_releaseSame familyAutomates publishing Dart packages to pub.dev, handling version bump, git tags, changelog, and optional dry-run.
- dswitchSame familyCLI tool to rapidly switch between channels and versions of standalone Dart.