From 210cc00385f8f98f3e46408db2701d26ee65f695 Mon Sep 17 00:00:00 2001 From: Mogeko Date: Tue, 16 Nov 2021 18:37:29 +0000 Subject: [PATCH 1/3] feat: run qbittorrent-nox with a script --- Dockerfile | 8 +++----- root/config/.gitkeep | 0 qBittorrent.conf => root/default/qBittorrent.conf | 0 root/downloads/.gitkeep | 0 root/qBittorrent/config | 1 + root/run.sh | 11 +++++++++++ 6 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 root/config/.gitkeep rename qBittorrent.conf => root/default/qBittorrent.conf (100%) create mode 100644 root/downloads/.gitkeep create mode 120000 root/qBittorrent/config create mode 100755 root/run.sh diff --git a/Dockerfile b/Dockerfile index f59fba4..234018e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,16 +6,14 @@ RUN apk add --no-cache \ -X http://dl-cdn.alpinelinux.org/alpine/edge/testing \ qbittorrent-nox=${VERSION} -ADD --chown=1000:100 qBittorrent.conf /qBittorrent/config/ - -RUN chmod -R g+w /qBittorrent +ADD --chown=1000:100 root / EXPOSE 6881 6881/udp 8080 ENV QBT_WEBUI_PORT=8080 -VOLUME [ "/downloads" ] +VOLUME [ "/config", "/downloads" ] -ENTRYPOINT [ "/usr/bin/qbittorrent-nox" ] +ENTRYPOINT [ "/run.sh" ] CMD [ "--profile=/" ] diff --git a/root/config/.gitkeep b/root/config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/qBittorrent.conf b/root/default/qBittorrent.conf similarity index 100% rename from qBittorrent.conf rename to root/default/qBittorrent.conf diff --git a/root/downloads/.gitkeep b/root/downloads/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/root/qBittorrent/config b/root/qBittorrent/config new file mode 120000 index 0000000..3ca249e --- /dev/null +++ b/root/qBittorrent/config @@ -0,0 +1 @@ +../config \ No newline at end of file diff --git a/root/run.sh b/root/run.sh new file mode 100755 index 0000000..e96e672 --- /dev/null +++ b/root/run.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +_command=/usr/bin/qbittorrent-nox +_config_file=/config/qBittorrent.conf +_config_example=/default/qBittorrent.conf + +if [ ! -f "${_config_file}" ]; then + install -p -m 664 "${_config_example}" "${_config_file}" +fi + +exec "${_command}" "$@" From 7cae91e685412c6207e9f1d275bf1ab355eba830 Mon Sep 17 00:00:00 2001 From: Mogeko Date: Tue, 16 Nov 2021 18:54:54 +0000 Subject: [PATCH 2/3] docs(readme): add rootless related guidelines --- README.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index dff2549..289e5c5 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,17 @@ Docker image for qBittorrent. +- Tiny size +- Enable rootless[^1] +- Enable `QBT_*` options[^2] +- Keep updating + ## Usage Pull this image: ```shell -docker pull ghcr.io/mogeko/qbittorrent:edge +docker pull ghcr.io/mogeko/qbittorrent ``` Run with docker cli: @@ -17,6 +22,7 @@ Run with docker cli: ```shell docker run -d \ --name qbittorrent \ + --user 1000:100 `#optional` \ -e QBT_WEBUI_PORT=8080 \ -p 6881:6881 \ -p 6881:6881/udp \ @@ -35,6 +41,7 @@ services: qbittorrent: image: ghcr.io/mogeko/qbittorrent container_name: qbittorrent + user: 1000:100 #optional environment: - QBT_WEBUI_PORT=8080 volumes: @@ -58,12 +65,12 @@ Container images are configured using parameters passed at runtime (such as thos | `-e QBT_WEBUI_PORT=8080` | Change the Web UI port | | `-v /downloads` | Location of downloads on disk | -The `qbittorrent-nox`'s options may be supplied via environment variables[^1]. For option named 'parameter-name', environment variable name is `QBT_PARAMETER_NAME` (in uppercase, `-` replaced with `_`). To pass flag values, set the variable to `1` or `TRUE`. Here is an example we already in used: `-e QBT_WEBUI_PORT=8080`. +The `qbittorrent-nox`'s options may be supplied via environment variables[^2]. For option named 'parameter-name', environment variable name is `QBT_PARAMETER_NAME` (in uppercase, `-` replaced with `_`). To pass flag values, set the variable to `1` or `TRUE`. Here is an example we already in used: `-e QBT_WEBUI_PORT=8080`. More help message about `qbittorrent-nox`, you can get via: ```shell -docker run -it ghcr.io/mogeko/qbittorrent:edge --help +docker run -it ghcr.io/mogeko/qbittorrent --help ``` ## License @@ -73,7 +80,8 @@ The code in this project is released under the [GPL-3.0 License][license]. -[^1]: The option `QBT_PROFILE` does not support. +[^1]: This image should be able to work with [podman], but it has not been tested. +[^2]: The option `QBT_PROFILE` does not support. @@ -84,3 +92,4 @@ The code in this project is released under the [GPL-3.0 License][license]. [docker-compose]: https://docs.docker.com/compose [license]: https://github.com/mogeko/docker-qbittorrent/blob/master/LICENSE +[podman]: https://podman.io From 6604892534f951ebb2a25f7dbb97e2f2676ed9b5 Mon Sep 17 00:00:00 2001 From: Mogeko Date: Tue, 16 Nov 2021 19:02:16 +0000 Subject: [PATCH 3/3] docs: enable configuration files --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 289e5c5..2382513 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ docker run -d \ -p 6881:6881 \ -p 6881:6881/udp \ -p 8080:8080 \ + -v /path/to/config:/config \ -v /path/to/downloads:/downloads \ --restart unless-stopped \ ghcr.io/mogeko/qbittorrent @@ -45,6 +46,7 @@ services: environment: - QBT_WEBUI_PORT=8080 volumes: + - /path/to/config:/config - /path/to/downloads:/downloads ports: - 6881:6881 @@ -63,6 +65,7 @@ Container images are configured using parameters passed at runtime (such as thos | `-p 6881/udp` | udp connection port | | `-p 8080` | The Web UI port | | `-e QBT_WEBUI_PORT=8080` | Change the Web UI port | +| `-v /config` | Save the configuration files | | `-v /downloads` | Location of downloads on disk | The `qbittorrent-nox`'s options may be supplied via environment variables[^2]. For option named 'parameter-name', environment variable name is `QBT_PARAMETER_NAME` (in uppercase, `-` replaced with `_`). To pass flag values, set the variable to `1` or `TRUE`. Here is an example we already in used: `-e QBT_WEBUI_PORT=8080`.