Skip to content

Commit 556ce51

Browse files
committed
Support nonroot operation
1 parent 183f0e6 commit 556ce51

7 files changed

Lines changed: 52 additions & 35 deletions

File tree

Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,17 @@ RUN \
2121
apk add --no-cache --upgrade --virtual=build-dependencies \
2222
build-base && \
2323
echo "**** install packages ****" && \
24+
if [ -z ${DELUGE_VERSION+x} ]; then \
25+
DELUGE_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
26+
&& awk '/^P:deluge$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \
27+
fi && \
2428
apk add --no-cache --upgrade --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
29+
deluge==${DELUGE_VERSION} \
2530
python3 \
2631
py3-future \
2732
py3-geoip \
2833
py3-requests \
2934
p7zip && \
30-
if [ -z ${DELUGE_VERSION+x} ]; then \
31-
DELUGE_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
32-
&& awk '/^P:deluge$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \
33-
fi && \
34-
apk add -U --upgrade --no-cache \
35-
deluge==${DELUGE_VERSION} && \
3635
echo "**** grab GeoIP database ****" && \
3736
curl -L --retry 10 --retry-max-time 60 --retry-all-errors \
3837
"https://mailfud.org/geoip-legacy/GeoIP.dat.gz" \

Dockerfile.aarch64

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,17 @@ RUN \
2121
apk add --no-cache --upgrade --virtual=build-dependencies \
2222
build-base && \
2323
echo "**** install packages ****" && \
24+
if [ -z ${DELUGE_VERSION+x} ]; then \
25+
DELUGE_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
26+
&& awk '/^P:deluge$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \
27+
fi && \
2428
apk add --no-cache --upgrade --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
29+
deluge==${DELUGE_VERSION} \
2530
python3 \
2631
py3-future \
2732
py3-geoip \
2833
py3-requests \
2934
p7zip && \
30-
if [ -z ${DELUGE_VERSION+x} ]; then \
31-
DELUGE_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \
32-
&& awk '/^P:deluge$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \
33-
fi && \
34-
apk add -U --upgrade --no-cache \
35-
deluge==${DELUGE_VERSION} && \
3635
echo "**** grab GeoIP database ****" && \
3736
curl -L --retry 10 --retry-max-time 60 --retry-all-errors \
3837
"https://mailfud.org/geoip-legacy/GeoIP.dat.gz" \

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Find us at:
4646
* Plugin System
4747
* Much more...
4848

49-
[![deluge](https://avatars2.githubusercontent.com/u/6733935?v=3&s=200)](http://deluge-torrent.org/)
49+
[![deluge](https://raw.githubusercontent.com/linuxserver/docker-templates/blob/master/linuxserver.io/img/deluge-logo.png)](http://deluge-torrent.org/)
5050

5151
## Supported Architectures
5252

@@ -83,6 +83,10 @@ Change the inbound port to 6881 (or whichever port you've mapped for the contain
8383

8484
This image can be run with a read-only container filesystem. For details please [read the docs](https://docs.linuxserver.io/misc/read-only/).
8585

86+
## Non-Root Operation
87+
88+
This image can be run with a non-root user. For details please [read the docs](https://docs.linuxserver.io/misc/non-root/).
89+
8690
## Usage
8791

8892
To help you get started creating a container from this image you can either use docker-compose or the docker cli.
@@ -150,6 +154,7 @@ Containers are configured using parameters passed at runtime (such as those abov
150154
| `-v /config` | deluge configs |
151155
| `-v /downloads` | torrent download directory |
152156
| `--read-only=true` | Run container with a read-only filesystem. Please [read the docs](https://docs.linuxserver.io/misc/read-only/). |
157+
| `--user=1000:1000` | Run container with a non-root user. Please [read the docs](https://docs.linuxserver.io/misc/non-root/). |
153158

154159
## Environment variables from files (Docker secrets)
155160

@@ -313,6 +318,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
313318

314319
## Versions
315320

321+
* **12.01.25:** - Rebase libtorrentv1 branch to Alpine 3.21.
316322
* **19.09.24:** - Prevent race condition related delay during container stop.
317323
* **26.08.24:** - Add libtorrentv1 tag.
318324
* **26.12.23:** - Replace source for GeoIP database.

readme-vars.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# project information
44
project_name: deluge
55
project_url: "http://deluge-torrent.org/"
6-
project_logo: "https://avatars2.githubusercontent.com/u/6733935?v=3&s=200"
6+
project_logo: "https://raw.githubusercontent.com/linuxserver/docker-templates/blob/master/linuxserver.io/img/deluge-logo.png"
77
project_blurb: |
88
[{{ project_name|capitalize }}]({{ project_url }}) is a lightweight, Free Software, cross-platform BitTorrent client.
99
@@ -40,6 +40,7 @@ opt_param_usage_include_ports: true
4040
opt_param_ports:
4141
- {external_port: "58846", internal_port: "58846", port_desc: "Default deluged port for thin client connectivity"}
4242
readonly_supported: true
43+
nonroot_supported: true
4344
# application setup block
4445
app_setup_block_enabled: true
4546
app_setup_block: |
@@ -92,6 +93,7 @@ init_diagram: |
9293
"deluge:latest" <- Base Images
9394
# changelog
9495
changelogs:
96+
- {date: "12.01.25:", desc: "Rebase libtorrentv1 branch to Alpine 3.21."}
9597
- {date: "19.09.24:", desc: "Prevent race condition related delay during container stop."}
9698
- {date: "26.08.24:", desc: "Add libtorrentv1 tag."}
9799
- {date: "26.12.23:", desc: "Replace source for GeoIP database."}

root/etc/s6-overlay/s6-rc.d/init-deluge-config/run

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@ fi
77

88
mkdir -p /run/deluged-temp
99

10-
# permissions
11-
lsiown -R abc:abc \
12-
/run/deluged-temp \
13-
/config
14-
15-
# chown download directory if currently not set to abc
16-
if [[ -d /downloads ]]; then
17-
if [[ "$(stat -c '%U' /downloads)" != "abc" ]]; then
18-
lsiown -R abc:abc /downloads
19-
fi
20-
fi
21-
2210
# create torrents directory if it does not exist
2311
if [[ ! -d /config/torrents ]]; then
2412
mkdir -p /config/torrents
25-
lsiown abc:abc /config/torrents
13+
fi
14+
15+
if [[ -z ${LSIO_NON_ROOT_USER} ]]; then
16+
# permissions
17+
lsiown -R abc:abc \
18+
/run/deluged-temp \
19+
/config
20+
21+
# chown download directory if currently not set to abc
22+
if [[ -d /downloads ]]; then
23+
if [[ "$(stat -c '%U' /downloads)" != "abc" ]]; then
24+
lsiown -R abc:abc /downloads
25+
fi
26+
fi
2627
fi

root/etc/s6-overlay/s6-rc.d/svc-deluge-web/run

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ if [[ -f /config/web.conf ]]; then
77
DELUGE_WEB_PORT=$(grep 'port"' /config/web.conf | tr -cd "[:digit:]")
88
fi
99

10-
exec \
11-
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z 127.0.0.1 ${DELUGE_WEB_PORT:-8112}" \
12-
s6-setuidgid abc /usr/bin/deluge-web \
13-
-d -c /config --loglevel="${DELUGE_LOGLEVEL}"
10+
if [[ -z ${LSIO_NON_ROOT_USER} ]]; then
11+
exec \
12+
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z 127.0.0.1 ${DELUGE_WEB_PORT:-8112}" \
13+
s6-setuidgid abc /usr/bin/deluge-web -d -c /config --loglevel="${DELUGE_LOGLEVEL}"
14+
else
15+
exec \
16+
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z 127.0.0.1 ${DELUGE_WEB_PORT:-8112}" \
17+
/usr/bin/deluge-web -d -c /config --loglevel="${DELUGE_LOGLEVEL}"
18+
fi

root/etc/s6-overlay/s6-rc.d/svc-deluged/run

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ if [[ -f /config/core.conf ]]; then
77
DELUGED_PORT=$(grep '"daemon_port"' /config/core.conf | tr -cd "[:digit:]")
88
fi
99

10-
exec \
11-
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z 127.0.0.1 ${DELUGED_PORT:-58846}" \
12-
s6-setuidgid abc /usr/bin/deluged -c /config \
13-
-d --loglevel="${DELUGE_LOGLEVEL}"
10+
if [[ -z ${LSIO_NON_ROOT_USER} ]]; then
11+
exec \
12+
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z 127.0.0.1 ${DELUGED_PORT:-58846}" \
13+
s6-setuidgid abc /usr/bin/deluged -c /config -d --loglevel="${DELUGE_LOGLEVEL}"
14+
else
15+
exec \
16+
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z 127.0.0.1 ${DELUGED_PORT:-58846}" \
17+
/usr/bin/deluged -c /config -d --loglevel="${DELUGE_LOGLEVEL}"
18+
fi

0 commit comments

Comments
 (0)