Skip to content
Snippets Groups Projects
Commit 4721fa10 authored by nimrod's avatar nimrod
Browse files

A different approach for proper user setting.

Get the uid and gid from the owner and group of the Downloads folder (if
it exists). Use /var/lib/transmission as both the home directory and
Transmission' home directory (instead of ~/.config/transmission-daemon).
No need to set the user or mount /etc/passwd in the Compose config.
parent a69c2b5e
No related branches found
No related tags found
No related merge requests found
Pipeline #916 passed
......@@ -6,15 +6,14 @@ RUN apk add --update --no-cache --repository http://dl-cdn.alpinelinux.org/alpin
apk add --update --no-cache \
transmission-daemon \
&& \
install -d -m 555 /var/lib/transmission && \
mkdir -m 777 /run/transmission && \
mkdir /etc/transmission
COPY --chown=root:root entrypoint /
COPY settings.json /etc/transmission/
mkdir -m 777 /run/transmission
COPY --chown=root:root entrypoint /usr/local/sbin/docker-entrypoint
COPY --chown=root:root settings.json /etc/transmission/
VOLUME /var/lib/transmission
WORKDIR /var/lib/transmission
ENV HOME /var/lib/transmission
ENV TRANSMISSION_HOME /var/lib/transmission
EXPOSE 9091 51413/tcp 51413/udp
ENTRYPOINT [ "/entrypoint" ]
ENTRYPOINT [ "docker-entrypoint" ]
CMD [ "transmission-daemon", "--foreground" ]
HEALTHCHECK CMD wget --spider http://localhost:9091/transmission || exit 1
#!/bin/sh
set -eux
mkdir -p /var/lib/transmission/downloads
install -d -o transmission -g transmission -m 750 /var/lib/transmission/.config/transmission-daemon/
install -o transmission -g transmission -m 640 /etc/transmission/settings.json /var/lib/transmission/.config/transmission-daemon/settings.json
command -v stat > /dev/null || { echo "Can't find stat, exiting."; exit 1; }
command -v gosu > /dev/null || { echo "Can't find gosu, exiting."; exit 1; }
eval exec gosu "transmission:transmission" "$@"
ln -sf /etc/transmission/settings.json ./settings.json
if [ -d ./Downloads ] && [ "$(id -u)" -eq '0' ]
then
uid="$(stat ./Downloads -c '%u')"
gid="$(stat ./Downloads -c '%g')"
chown "$uid:$gid" ./
eval exec gosu "$uid:$gid" "$@"
else
eval exec "$@"
fi
......@@ -9,8 +9,6 @@ services:
- 51413:51413/tcp
- 51413:51413/udp
volumes:
- /etc/group:/etc/group:ro
- /etc/passwd:/etc/passwd:ro
- daemon:/var/lib/transmission
- /srv/library:/var/lib/transmission/downloads
restart: always
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment