Bollard can tunnel all Docker API calls over an SSH connection using the openssh crate. This means you can reach a remote Docker daemon without opening any extra TCP ports — the only requirement is an SSH connection to the remote host.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.
The SSH transport requires the
ssh feature flag, which is not enabled by default. Add it to your Cargo.toml:Docker::connect_with_ssh_defaults
Reads the target host from the DOCKER_HOST environment variable. If the variable is not set, it falls back to DEFAULT_SSH_ADDRESS (ssh://localhost).
Function signature
Address resolution
DOCKER_HOSTenvironment variable (e.g.ssh://user@remote-host).- Falls back to
"ssh://localhost"if unset.
Docker::connect_with_ssh
Use this when you need to specify the SSH target address, a custom timeout, a specific API version, or a path to an SSH keypair.
Function signature
| Parameter | Type | Description |
|---|---|---|
addr | &str | Target URL — must use the ssh:// scheme, e.g. ssh://user@host. |
timeout | u64 | Read/write timeout in seconds (default helpers use 120). |
client_version | &ClientVersion | Docker API version to request. Use API_DEFAULT_VERSION. |
keypair_path | Option<String> | Optional path to a PEM private key file. Pass None to use the SSH agent or default key locations. |
Constants
| Constant | Value |
|---|---|
DEFAULT_SSH_ADDRESS | "ssh://localhost" |
Environment Variables
| Variable | Description |
|---|---|
DOCKER_HOST | SSH URL of the remote Docker daemon, e.g. ssh://user@host or ssh://user@host:2222. Consumed by connect_with_ssh_defaults. |
SSH Key Setup
Bollard’s SSH connector delegates authentication to the openssh crate, which in turn uses the system’s SSH tooling. Ensure one of the following is true before calling the connection methods:Default key files are present
openssh will automatically try
~/.ssh/id_rsa, ~/.ssh/id_ed25519, ~/.ssh/id_ecdsa, and ~/.ssh/id_dsa in order.