From bbcc9a45fe534c5ad585ec2daaf2a79a6aaf8708 Mon Sep 17 00:00:00 2001 From: Ivan Andreev Date: Sun, 3 Oct 2021 18:55:35 +0300 Subject: [PATCH] serve/docker: allow to customize proxy settings of docker plugin --- cmd/serve/docker/contrib/plugin/Dockerfile | 4 ++++ cmd/serve/docker/contrib/plugin/config.json | 15 +++++++++++++++ docs/content/docker.md | 7 ++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/cmd/serve/docker/contrib/plugin/Dockerfile b/cmd/serve/docker/contrib/plugin/Dockerfile index f74f3c4f3..eec817ceb 100644 --- a/cmd/serve/docker/contrib/plugin/Dockerfile +++ b/cmd/serve/docker/contrib/plugin/Dockerfile @@ -26,6 +26,10 @@ ENV RCLONE_CACHE_DIR=/data/cache ENV RCLONE_BASE_DIR=/mnt ENV RCLONE_VERBOSE=0 +ENV HTTP_PROXY= +ENV HTTPS_PROXY= +ENV NO_PROXY= + WORKDIR /data ENTRYPOINT ["/usr/local/bin/rclone"] CMD ["serve", "docker"] diff --git a/cmd/serve/docker/contrib/plugin/config.json b/cmd/serve/docker/contrib/plugin/config.json index 217fba1ff..22d04aad2 100644 --- a/cmd/serve/docker/contrib/plugin/config.json +++ b/cmd/serve/docker/contrib/plugin/config.json @@ -42,6 +42,21 @@ { "name": "RCLONE_BASE_DIR", "value": "/mnt" + }, + { + "name": "HTTP_PROXY", + "value": "", + "settable": ["value"] + }, + { + "name": "HTTPS_PROXY", + "value": "", + "settable": ["value"] + }, + { + "name": "NO_PROXY", + "value": "", + "settable": ["value"] } ], "mounts": [ diff --git a/docs/content/docker.md b/docs/content/docker.md index bbdc3b6d2..0b015e2fc 100644 --- a/docs/content/docker.md +++ b/docs/content/docker.md @@ -347,7 +347,8 @@ swarm services that use them. This is rather tedious so please carefully plan in advance. You can tweak the following settings: -`args`, `config`, `cache`, and `RCLONE_VERBOSE`. +`args`, `config`, `cache`, `HTTP_PROXY`, `HTTPS_PROXY`, `NO_PROXY` +and `RCLONE_VERBOSE`. It's _your_ task to keep plugin settings in sync across swarm cluster nodes. `args` sets command-line arguments for the `rclone serve docker` command @@ -389,6 +390,8 @@ The plugin output by default feeds the docker daemon log on local host. Log entries are reflected as _errors_ in the docker log but retain their actual level assigned by rclone in the encapsulated message string. +`HTTP_PROXY`, `HTTPS_PROXY`, `NO_PROXY` customize the plugin proxy settings. + You can set custom plugin options right when you install it, _in one go_: ``` docker plugin remove rclone @@ -506,6 +509,8 @@ sudo curl -H Content-Type:application/json -XPOST -d {} --unix-socket /run/docke ``` though this is rarely needed. +## Caveats + Finally I'd like to mention a _caveat with updating volume settings_. Docker CLI does not have a dedicated command like `docker volume update`. It may be tempting to invoke `docker volume create` with updated options