Skip to content
pubscout

docker2

6.3.0, released 3 weeks ago by onepub.dev

Dart wrapper for Docker CLI to manage images and containers

$ flutter pub add docker2
Source repository

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.

Works with

Packages commonly used together with docker2: ones it builds on, ones built on it, and its own family.