From 6cf3abd45e52e382924491836db6c1361abe7fd3 Mon Sep 17 00:00:00 2001 From: Florian Apolloner Date: Thu, 22 May 2025 16:35:29 +0200 Subject: [PATCH] Enhancement: Support more docker API connection options. (#5304) --- docs/configs/docker.md | 12 ++++++++++++ src/utils/config/docker.js | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/docs/configs/docker.md b/docs/configs/docker.md index c228f72e3..af3eabb64 100644 --- a/docs/configs/docker.md +++ b/docs/configs/docker.md @@ -79,6 +79,18 @@ my-docker: Note: This does not require TLS certificates if the proxy handles encryption. Do not use `protocol: https` unless you’re sure the target host supports HTTPS. +You can further customize the connection options via `pathPrefix` and `headers`: + +```yaml +my-docker: + host: dockerproxy + port: 443 + protocol: https + pathPrefix: /docker_api/ # If a reverse proxy serves the API on a subpath + headers: + Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== # Send an authorization header if the API access is secured via basic auth +``` + ## Using Socket Directly If you'd rather use the socket directly, first make sure that you're passing the local socket into the Docker container. diff --git a/src/utils/config/docker.js b/src/utils/config/docker.js index 5dcef4da0..1fa3f3edf 100644 --- a/src/utils/config/docker.js +++ b/src/utils/config/docker.js @@ -47,6 +47,14 @@ export default function getDockerArguments(server) { res.conn.protocol = servers[server].protocol; } + if (servers[server].pathPrefix) { + res.conn.pathPrefix = servers[server].pathPrefix; + } + + if (servers[server].headers) { + res.conn.headers = servers[server].headers; + } + return res; }