Bollard can reach a remote Docker daemon over a plain HTTP/TCP connection. This is the simplest way to talk to a Docker host that has been configured to listen on a TCP port, and it is also the transport used whenDocumentation 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.
DOCKER_HOST is set to a tcp:// or http:// address.
Docker::connect_with_http_defaults
Reads the DOCKER_HOST environment variable to determine the target address. If the variable is not set, it falls back to tcp://localhost:2375.
Function signature
How the address is resolved
- Read
DOCKER_HOSTfrom the environment. - If unset, use
DEFAULT_TCP_ADDRESS("tcp://localhost:2375"). - Strip the
tcp://orhttp://scheme prefix before handing the address to Hyper.
Docker::connect_with_http
Use this when you need to specify the remote address, a custom timeout, or a specific API version at call time.
Function signature
| Parameter | Type | Description |
|---|---|---|
addr | &str | Connection URL — tcp:// or http:// scheme with host and port. |
timeout | u64 | Read/write timeout in seconds (default helpers use 120). |
client_version | &ClientVersion | Docker API version to request. Use API_DEFAULT_VERSION for the latest supported version. |
Docker::connect_with_host
A higher-level dispatcher that selects the correct transport based on the URL scheme. For tcp:// and http:// addresses it routes to connect_with_http (and will automatically upgrade to SSL if DOCKER_TLS_VERIFY is set and the ssl feature is enabled).
Function signature
connect_with_host also dispatches unix://, npipe://, https://, and ssh:// schemes to the appropriate connector, making it useful as a single entry point when the transport is determined at runtime.Environment Variables
| Variable | Description |
|---|---|
DOCKER_HOST | Full URL of the Docker daemon. Examples: tcp://localhost:2375, http://192.168.1.10:2375. Accepted by both connect_with_http_defaults and connect_with_host. |
Constants
| Constant | Value |
|---|---|
DEFAULT_TCP_ADDRESS | "tcp://localhost:2375" |
Feature Flag
The HTTP connector requires the
http feature, which is enabled by default. If you have disabled default features, add it explicitly: