Docker daemon API in Rust
Alternatives To Bollard
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
20 hours ago1June 20, 201865apache-2.0JavaScript
Zenko CloudServer, an open-source Node.js implementation of the Amazon S3 protocol on the front-end and backend storage capabilities to multiple clouds, including Azure and Google.
Bollard4772224 days ago29June 20, 202222apache-2.0Rust
Docker daemon API in Rust
Docker Registry Manager312
4 years ago7August 04, 201917apache-2.0Go
Web front end for managing multiple private docker registries
17 days ago34apache-2.0Shell
Build scripts for Docker images (Dockerfiles) and Docker related utilities for WebSphere Liberty.
17 days ago7gpl-3.0C#
GPS tracking system based on .NET and React.
5 years ago7apache-2.0C++
the backend of SDE's language server
Node Docker Api54
6 years agoJavaScript
developing and testing microservices with docker
3 years agoapache-2.0JavaScript
Extract and Visualize location from any file
Flask Api27
2 years agomitPython
sample project building an api using flask
6 years ago4Shell private instance docker build file
Alternatives To Bollard
Select To Compare

Alternative Project Comparisons
Readme license circle-ci appveyor docs

Bollard: an asynchronous rust client library for the docker API

Bollard leverages the latest Hyper and Tokio improvements for an asynchronous API containing futures, streams and the async/await paradigm.

This library features Windows support through Named Pipes and HTTPS support through optional Rustls bindings. Serialization types for interfacing with Docker and Buildkit are generated through OpenAPI, protobuf and upstream documentation.


Add the following to your Cargo.toml file

bollard = "*"



API docs.


Version 0.14 enables a buildkit feature for builds using public images (check the buildkit example for details on how to configure).

Feature flags

  • ssl: enable SSL support through Rustls
  • chrono: enable Chrono for DateTime types.
  • time: enable Time 0.3 for DateTime types.
  • buildkit: use Buildkit instead of Docker when building images.
  • json_data_content: Add JSON to errors on serialization failures.
  • ct_logs: Certificate transparency verification (requires ssl).


The Docker API used by Bollard is using the latest 1.41 documentation schema published by the moby project to generate its serialization interface.

This library also supports version negotiation, to allow downgrading to an older API version.


Connecting with the docker daemon

Connect to the docker server according to your architecture and security remit.


The client will connect to the standard unix socket location /var/run/docker.sock or Windows named pipe location //./pipe/docker_engine.

use bollard::Docker;

Use the Docker::connect_with_socket method API to parameterise this interface.


The client will connect to the OS specific handler it is compiled for.

This is a convenience for localhost environment that should run on multiple operating systems.

use bollard::Docker;

Use the Docker::connect_with_local method API to parameterise this interface.


The client will connect to the location pointed to by DOCKER_HOST environment variable, or localhost:2375 if missing.

use bollard::Docker;

Use the Docker::connect_with_http method API to parameterise the interface.

SSL via Rustls

The client will connect to the location pointed to by DOCKER_HOST environment variable, or localhost:2375 if missing.

The location pointed to by the DOCKER_CERT_PATH environment variable is searched for certificates - key.pem for the private key, cert.pem for the server certificate and ca.pem for the certificate authority chain.

use bollard::Docker;
#[cfg(feature = "ssl")]

Use the Docker::connect_with_ssl method API to parameterise the interface.


Note: all these examples need a Tokio Runtime.


First, check that the API is working with your server:

use bollard::Docker;

use futures_util::future::FutureExt;

// Use a connection function described above
// let docker = Docker::connect_...;

async move {
    let version = docker.version().await.unwrap();
    println!("{:?}", version);

Listing images

To list docker images available on the Docker server:

use bollard::Docker;
use bollard::image::ListImagesOptions;

use futures_util::future::FutureExt;

use std::default::Default;

// Use a connection function described above
// let docker = Docker::connect_...;

async move {
    let images = &docker.list_images(Some(ListImagesOptions::<String> {
        all: true,

    for image in images {
        println!("-> {:?}", image);

Streaming Stats

To receive a stream of stats for a running container.

use bollard::Docker;
use bollard::container::StatsOptions;

use futures_util::stream::TryStreamExt;

use std::default::Default;

// Use a connection function described above
// let docker = Docker::connect_...;

async move {
    let stats = &docker.stats("postgres", Some(StatsOptions {
       stream: true,

    for stat in stats {
        println!("{} - mem total: {:?} | mem usage: {:?}",


Further examples are available in the examples folder, or the integration/unit tests.


Contributions are welcome, please observe the following.

Building the proto models

Serialization models for the buildkit feature are generated through the Tonic library. To generate these files, use the following in the codegen/proto folder:

cargo run --bin gen --features build

Building the swagger models

Serialization models are generated through the Swagger library. To generate these files, use the following in the codegen/swagger folder:

mvn -D org.slf4j.simpleLogger.defaultLogLevel=error compiler:compile generate-resources

Integration tests

Running the integration tests by default requires a running docker registry, with images tagged and pushed there. To disable this behaviour, set the DISABLE_REGISTRY environment variable.

docker run -d --restart always --name registry -p 5000:5000 registry:2
docker pull hello-world:linux
docker pull fussybeaver/uhttpd
docker pull alpine
docker tag hello-world:linux localhost:5000/hello-world:linux
docker tag fussybeaver/uhttpd localhost:5000/fussybeaver/uhttpd
docker tag alpine localhost:5000/alpine
docker push localhost:5000/hello-world:linux
docker push localhost:5000/fussybeaver/uhttpd
docker push localhost:5000/alpine
docker swarm init
REGISTRY_HTTP_ADDR=localhost:5000 cargo test -- --test-threads 1

License: Apache-2.0

Popular Docker Projects
Popular Location Projects
Popular Virtualization Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.