Skip to content

Instantly share code, notes, and snippets.

@Madh93
Last active January 19, 2018 18:30
Show Gist options
  • Save Madh93/80834c71b876bdf25f840e74099f5e2c to your computer and use it in GitHub Desktop.
Save Madh93/80834c71b876bdf25f840e74099f5e2c to your computer and use it in GitHub Desktop.
Rpi-tranmission scripts in Docker
FROM hypriot/rpi-alpine-scratch
MAINTAINER Miguel Hernandez "[email protected]"
# Install transmission
RUN apk update \
&& apk add transmission-daemon bash vim \
&& rm -rf /var/cache/apk/*
# Copy custom settings
COPY settings.json /app/config/
# Add to 'users' group
RUN addgroup transmission users
# Set up directories and permissions
RUN chown -R transmission:users /app \
&& chmod g+s /app \
&& mkdir /app/completed /app/incomplete \
&& chmod -R 775 /app
# Continue as user 'transmission'
USER transmission
# Expose volumes:
VOLUME /app/completed /app/incomplete
EXPOSE 9091
EXPOSE 51413
EXPOSE 51413/udp
CMD ["/usr/bin/transmission-daemon", "-f", "-g", "/app/config"]
[Unit]
Description=Run Transmission in a Docker container
Requires=docker.service multi-user.target
After=docker.service network-online.target dhcpd.service
[Service]
Type=simple
Restart=always
PIDFile=/var/run/rpi-transmission.pid
ExecStartPre=/bin/rm -f /var/run/rpi-transmission.pid
ExecStart=/usr/local/bin/rpi-transmission
ExecStop=/usr/bin/docker stop -t 2 rpi-transmission
[Install]
WantedBy=multi-user.target
#! /bin/bash
# https://github.com/diginc/docker-pi-hole/blob/master/docker_run.sh
MY_USER="migue"
DIRECTORY="/home/$MY_USER/Torrent"
if [ -n "$(docker ps -a -q --filter name=rpi-transmission)" ]; then
docker start -a rpi-transmission
else
# Default ports + daemonized docker container
docker run -d --restart=always --name rpi-transmission \
-v /etc/localtime:/etc/localtime:ro \
-v $DIRECTORY/completed:/app/completed \
-v $DIRECTORY/incomplete:/app/incomplete \
-p 9091:9091 \
-p 51413:51413/udp \
-p 51413:51413/tcp \
rpi-transmission
fi

Rpi-tranmission scripts in Docker

  • Rpi-transmission run script
  • Rpi-transmission service script
  • Rpi-transmission Dockerfile
  • Rpi-transmission settings file
{
"download-dir": "/app/completed",
"incomplete-dir": "/app/incomplete",
"incomplete-dir-enabled": true,
"rpc-whitelist": "127.0.0.1",
"rpc-whitelist-enabled": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment