Skip to content

Instantly share code, notes, and snippets.

@thrnz
Created September 15, 2020 04:18
Show Gist options
  • Save thrnz/dcbaa0af66c70af8e302a1c7eb75484a to your computer and use it in GitHub Desktop.
Save thrnz/dcbaa0af66c70af8e302a1c7eb75484a to your computer and use it in GitHub Desktop.
Helper container to pass forwarded port to Deluge
FROM alpine:latest
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories && \
echo "http://dl-cdn.alpinelinux.org/alpine/edge/community/" >> /etc/apk/repositories && \
echo "http://dl-cdn.alpinelinux.org/alpine/edge/main/" >> /etc/apk/repositories && \
apk add --no-cache bash deluge
ADD pia-port.sh /scripts/pia-port.sh
RUN chmod +x /scripts/*.sh
CMD ["/scripts/pia-port.sh"]
#!/bin/bash
trap 'exit 0' SIGTERM
OLDPORT=0
PORT=0
while true
do
[ -r "/pia-shared/port.dat" ] && PORT=$(cat /pia-shared/port.dat)
if [ $OLDPORT -ne $PORT ]; then
echo "Setting Deluge port settings ($PORT)..."
deluge-console --config=/deluge/conf "config --set listen_ports ($PORT,$PORT)"
OLDPORT=$PORT
fi
sleep 30 &
wait $!
done
@andrewfraley
Copy link

andrewfraley commented May 11, 2024

Some recent change in Alpine started causing these errors coming from the deluge binary:

Error relocating /usr/lib/libpython3.12.so.1.0: pwritev2: symbol not found
Error relocating /usr/lib/libpython3.12.so.1.0: preadv2: symbol not found

The solution is to upgrade the musl package when building the container, so your Dockerfile would then look like:

FROM alpine:latest
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories && \
    echo "http://dl-cdn.alpinelinux.org/alpine/edge/community/" >> /etc/apk/repositories && \
    echo "http://dl-cdn.alpinelinux.org/alpine/edge/main/" >> /etc/apk/repositories && \
    apk add --no-cache bash deluge && \
    apk upgrade musl
ADD pia-port.sh /scripts/pia-port.sh
RUN chmod +x /scripts/*.sh
CMD ["/scripts/pia-port.sh"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment