Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/fussybeaver/bollard/llms.txt

Use this file to discover all available pages before exploring further.

Bollard is a production-ready Rust library that gives you full programmatic access to the Docker and Podman container runtimes. Built on Hyper and Tokio, it exposes a fully async API covering containers, images, networks, volumes, Swarm orchestration, and BuildKit image builds — all as native Rust futures and streams.

Quickstart

Get Bollard installed and make your first API call in minutes

Installation

Add Bollard to your Cargo.toml with the right feature flags

Connecting

Connect via Unix socket, HTTP, SSL/TLS, SSH, or Podman

API Reference

Complete reference for every method on the Docker client

What Bollard Covers

Bollard wraps the Docker Engine API v1.52/1.53, giving you Rust-native access to every Docker resource:

Containers

Create, start, stop, inspect, exec, and stream logs

Images

Pull, build, tag, push, and export images

Networks & Volumes

Manage bridge networks, overlays, and named volumes

BuildKit

Advanced multi-stage builds via gRPC and BuildKit

Swarm

Orchestrate services, nodes, tasks, secrets, and configs

Error Handling

Typed errors for robust production code

Get Running in 3 Steps

1

Add Bollard to Cargo.toml

Cargo.toml
[dependencies]
bollard = "0.21"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
2

Create a Docker client

use bollard::Docker;

let docker = Docker::connect_with_local_defaults().unwrap();
3

Make your first API call

#[tokio::main]
async fn main() {
    let docker = Docker::connect_with_local_defaults().unwrap();
    let version = docker.version().await.unwrap();
    println!("Docker version: {:?}", version.version);
}

Transport Options

Bollard supports every connection mode Docker exposes:
TransportFeature FlagUse Case
Unix socket / Named pipepipe (default)Local Docker on Linux/macOS/Windows
HTTP/TCPhttp (default)Remote Docker via DOCKER_HOST
HTTPS via RustlssslSecure remote Docker
SSH tunnelsshRemote Docker over SSH
Podman socketpipe (default)Local or rootless Podman
The default feature set (http + pipe) covers most use cases. Add ssl, ssh, or buildkit only as needed to keep your binary lean.

Build docs developers (and LLMs) love