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/README.md b/README.md index dff2549..2382513 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,10 +22,12 @@ 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 \ -p 8080:8080 \ + -v /path/to/config:/config \ -v /path/to/downloads:/downloads \ --restart unless-stopped \ ghcr.io/mogeko/qbittorrent @@ -35,9 +42,11 @@ services: qbittorrent: image: ghcr.io/mogeko/qbittorrent container_name: qbittorrent + user: 1000:100 #optional environment: - QBT_WEBUI_PORT=8080 volumes: + - /path/to/config:/config - /path/to/downloads:/downloads ports: - 6881:6881 @@ -56,14 +65,15 @@ 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[^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 +83,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 +95,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 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}" "$@"