Bollard communicates with the Docker Engine API using a versioned URL prefix (e.g.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.
/v1.53/containers/json). By default it targets the most recent API version it was built against. When connecting to an older Docker daemon you can ask Bollard to negotiate the highest mutually-supported version automatically — no manual version pinning required.
Default API Version
Bollard ships with the following compile-time default, exported as a public constant:Docker::connect_with_local_defaults()) uses API_DEFAULT_VERSION unless you supply a different ClientVersion through the lower-level parameterised constructors such as Docker::connect_with_http().
Bollard’s serialization stubs are generated from the Docker API v1.53 OpenAPI schema published by the moby project. Negotiating down to an older version changes only the URL prefix — response fields that exist only in newer API versions will simply be absent or
null.The ClientVersion Struct
ClientVersion implements Display as "{major}.{minor}" (e.g. "1.53") and PartialOrd for numeric comparison, so Bollard can determine whether the server’s reported version is older than the client’s current setting.
Version Negotiation
Docker::negotiate_version()
An async method that queries GET /version on the connected daemon, parses the server’s ApiVersion field, and — if the server reports an older version than the client is currently using — atomically downgrades the client version in place. The updated Docker instance is returned so calls can be chained.
Version negotiation makes an additional HTTP round-trip to
GET /version. For latency-sensitive startup paths where the daemon version is known, you can skip negotiation and supply the version directly via the parameterised constructors.Docker::client_version()
Returns the ClientVersion that is currently set on the client — either the compile-time default or the value negotiated after calling negotiate_version().
Timeout Methods
Bollard applies a single timeout to every request. The default is 120 seconds (2 minutes).Docker::with_timeout(duration)
Builder-style method that returns a new Docker instance with the given timeout. Designed for method chaining.
Docker::timeout()
Returns the currently configured timeout as a std::time::Duration.
Code Examples
How Negotiation Works
Client sends GET /version
Bollard issues a request to the daemon’s
/version endpoint using the current client version prefix.Bollard compares versions
If
server_version < client_version, the client’s major and minor version atomics are updated to the server’s values.Bollard will never upgrade above
API_DEFAULT_VERSION during negotiation. If the server reports a higher version than the client default, the client version is left unchanged.Version Reference
| Constant | Value |
|---|---|
API_DEFAULT_VERSION | ClientVersion { major_version: 1, minor_version: 53 } |
| Default timeout | 120 seconds |
| Negotiation endpoint | GET /version |
| Serialization schema | Docker API v1.53 (moby OpenAPI) |
