pub fn connect() -> Result<Docker, GenericError>Expand description
Connect to the Docker daemon, searching non-standard socket locations on macOS.
Resolution order:
- If
DOCKER_HOSTis set or/var/run/docker.sockexists on disk, defer to bollard’s default connection logic — no extra work needed. - Otherwise, try each candidate socket path in order and use the first that exists.
- If no candidate is found, fall back to
Docker::connect_with_defaults()so the error message comes from bollard rather than from us.
§Candidate paths
These are checked (in order) when the standard socket is absent:
| Path | Environment |
|---|---|
$HOME/.docker/run/docker.sock | Docker Desktop |
$HOME/.orbstack/run/docker.sock | OrbStack |
$HOME/.rd/docker.sock | Rancher Desktop |
$HOME/.lima/default/sock/docker.sock | Lima (default instance) |
$HOME/.lima/docker/sock/docker.sock | Lima (docker instance) |
$HOME/.colima/default/docker.sock | Colima |
$HOME/.colima/docker/docker.sock | Colima (docker profile) |
$HOME/.local/share/containers/podman/machine/podman.sock | Podman Desktop (macOS) |
§Errors
Returns an error if no reachable Docker daemon can be found. When connecting through a discovered non-standard path, the error includes the path that was attempted.