• Stars
    star
    356
  • Rank 119,446 (Top 3 %)
  • Language
    Dockerfile
  • License
    MIT License
  • Created about 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

rTorrent and ruTorrent Docker image

Latest Version Build Status Docker Stars Docker Pulls
Become a sponsor Donate Paypal

About

rTorrent with ruTorrent Docker image.

Note

Want to be notified of new releases? Check out 🔔 Diun (Docker Image Update Notifier) project!


Features

  • Run as non-root user
  • Multi-platform image
  • Latest rTorrent / libTorrent release compiled from source
  • Latest ruTorrent release
  • Name resolving enhancements with c-ares for asynchronous DNS requests (including name resolves)
  • Enhanced rTorrent config and bootstraping with a local config
  • XMLRPC through nginx over SCGI socket (basic auth optional)
  • WebDAV on completed downloads (basic auth optional)
  • Ability to add a custom ruTorrent plugin / theme
  • Allow persisting specific configuration for ruTorrent plugins
  • ruTorrent GeoIP2 plugin
  • mktorrent installed for ruTorrent create plugin
  • Traefik Docker image as reverse proxy and creation/renewal of Let's Encrypt certificates (see this template)
  • geoip-updater Docker image to download MaxMind's GeoIP2 databases on a time-based schedule for geolocation

Build locally

git clone https://github.com/crazy-max/docker-rtorrent-rutorrent.git
cd docker-rtorrent-rutorrent

# Build image and output to docker (default)
docker buildx bake

# Build image
docker buildx bake image

# Build multi-platform image
docker buildx bake image-all

Image

Registry Image
Docker Hub crazymax/rtorrent-rutorrent
GitHub Container Registry ghcr.io/crazy-max/rtorrent-rutorrent

Following platforms for this image are available:

$ docker run --rm mplatform/mquery crazymax/rtorrent-rutorrent:latest
Image: crazymax/rtorrent-rutorrent:latest
 * Manifest List: Yes
 * Supported platforms:
   - linux/amd64
   - linux/arm/v6
   - linux/arm/v7
   - linux/arm64

Environment variables

General

  • TZ: The timezone assigned to the container (default UTC)
  • PUID: rTorrent user id (default 1000)
  • PGID: rTorrent group id (default 1000)
  • WAN_IP: Public IP address reported to the tracker (auto if empty)
  • WAN_IP_CMD: Command to resolve the Public IP address
  • MEMORY_LIMIT: PHP memory limit (default 256M)
  • UPLOAD_MAX_SIZE: Upload max size (default 16M)
  • CLEAR_ENV: Clear environment in FPM workers (default yes)
  • OPCACHE_MEM_SIZE: PHP OpCache memory consumption (default 128)
  • MAX_FILE_UPLOADS: The maximum number of files allowed to be uploaded simultaneously (default 50)
  • AUTH_DELAY: The time in seconds to wait for Basic Auth (default 0s)
  • REAL_IP_FROM: Trusted addresses that are known to send correct replacement addresses (default 0.0.0.0/32)
  • REAL_IP_HEADER: Request header field whose value will be used to replace the client address (default X-Forwarded-For)
  • LOG_IP_VAR: Use another variable to retrieve the remote IP address for access log_format on Nginx. (default remote_addr)
  • LOG_ACCESS: Output access log (default true)
  • XMLRPC_AUTHBASIC_STRING: Message displayed during validation of XMLRPC Basic Auth (default rTorrent XMLRPC restricted access)
  • XMLRPC_PORT: XMLRPC port through nginx over SCGI socket (default 8000)
  • XMLRPC_SIZE_LIMIT: Maximum body size of XMLRPC calls (default 1M)
  • RUTORRENT_AUTHBASIC_STRING: Message displayed during validation of ruTorrent Basic Auth (default ruTorrent restricted access)
  • RUTORRENT_PORT: ruTorrent HTTP port (default 8080)
  • WEBDAV_AUTHBASIC_STRING: Message displayed during validation of WebDAV Basic Auth (default WebDAV restricted access)
  • WEBDAV_PORT: WebDAV port on completed downloads (default 9000)

rTorrent

  • RT_LOG_LEVEL: rTorrent log level (default info)
  • RT_LOG_EXECUTE: Log executed commands to /data/rtorrent/log/execute.log (default false)
  • RT_LOG_XMLRPC: Log XMLRPC queries to /data/rtorrent/log/xmlrpc.log (default false)
  • RT_SESSION_SAVE_SECONDS: Seconds between writing torrent information to disk (default 3600)
  • RT_DHT_PORT: DHT UDP port (dht.port.set, default 6881)
  • RT_INC_PORT: Incoming connections (network.port_range.set, default 50000)

ruTorrent

  • RU_REMOVE_CORE_PLUGINS: Comma separated list of core plugins to remove ; set to false to disable removal (default httprpc)
  • RU_HTTP_USER_AGENT: ruTorrent HTTP user agent (default Mozilla/5.0 (Windows NT 6.0; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0)
  • RU_HTTP_TIME_OUT: ruTorrent HTTP timeout in seconds (default 30)
  • RU_HTTP_USE_GZIP: Use HTTP Gzip compression (default true)
  • RU_RPC_TIME_OUT: ruTorrent RPC timeout in seconds (default 5)
  • RU_LOG_RPC_CALLS: Log ruTorrent RPC calls (default false)
  • RU_LOG_RPC_FAULTS: Log ruTorrent RPC faults (default true)
  • RU_PHP_USE_GZIP: Use PHP Gzip compression (default false)
  • RU_PHP_GZIP_LEVEL: PHP Gzip compression level (default 2)
  • RU_SCHEDULE_RAND: Rand for schedulers start, +0..X seconds (default 10)
  • RU_LOG_FILE: ruTorrent log file path for errors messages (default /data/rutorrent/rutorrent.log)
  • RU_DO_DIAGNOSTIC: ruTorrent diagnostics like permission checking (default true)
  • RU_CACHED_PLUGIN_LOADING: Set to true to enable rapid cached loading of ruTorrent plugins (default false)
  • RU_SAVE_UPLOADED_TORRENTS: Save torrents files added wia ruTorrent in /data/rutorrent/share/torrents (default true)
  • RU_OVERWRITE_UPLOADED_TORRENTS: Existing .torrent files will be overwritten (default false)
  • RU_FORBID_USER_SETTINGS: If true, allows for single user style configuration, even with webauth (default false)
  • RU_LOCALE: Set default locale for ruTorrent (default UTF8)

Volumes

  • /data: rTorrent / ruTorrent config, session files, log, ...
  • /downloads: Downloaded files
  • /passwd: Contains htpasswd files for basic auth

⚠️ Note that the volumes should be owned by the user/group with the specified PUID and PGID. If you don't give the volumes correct permissions, the container may not start.

Ports

  • 6881 (or RT_DHT_PORT): DHT UDP port (dht.port.set)
  • 8000 (or XMLRPC_PORT): XMLRPC port through nginx over SCGI socket
  • 8080 (or RUTORRENT_PORT): ruTorrent HTTP port
  • 9000 (or WEBDAV_PORT): WebDAV port on completed downloads
  • 50000 (or RT_INC_PORT): Incoming connections (network.port_range.set)

⚠️ Port p+1 defined for XMLRPC_PORT, RUTORRENT_PORT and WEBDAV_PORT will also be reserved for healthcheck. (e.g. if you define RUTORRENT_PORT=8080, port 8081 will be reserved)

Usage

Docker Compose

Docker compose is the recommended way to run this image. Copy the content of folder examples/compose in /var/rtorrent-rutorrent/ on your host for example. Edit the compose file with your preferences and run the following command:

mkdir data downloads passwd
chown ${PUID}:${PGID} data downloads passwd
docker compose up -d
docker compose logs -f

Command line

You can also use the following minimal command:

mkdir data downloads passwd
chown ${PUID}:${PGID} data downloads passwd
docker run -d --name rtorrent_rutorrent \
  --ulimit nproc=65535 \
  --ulimit nofile=32000:40000 \
  -p 6881:6881/udp \
  -p 8000:8000 \
  -p 8080:8080 \
  -p 9000:9000 \
  -p 50000:50000 \
  -v $(pwd)/data:/data \
  -v $(pwd)/downloads:/downloads \
  -v $(pwd)/passwd:/passwd \
  crazymax/rtorrent-rutorrent:latest

Notes

XMLRPC through nginx

rTorrent 0.9.7+ has a built-in daemon mode disabling the user interface, so you can only control it via XMLRPC. Nginx will route XMLRPC requests to rtorrent through port 8000. These requests can be secured with basic authentication through the /passwd/rpc.htpasswd file in which you will need to add a username with his password. See below to populate this file with a user / password.

WebDAV

WebDAV allows you to retrieve your completed torrent files in /downloads/complete on port 9000. Like XMLRPC, these requests can be secured with basic authentication through the /passwd/webdav.htpasswd file in which you will need to add a username with his password. See below to populate this file with a user / password.

Populate .htpasswd files

For ruTorrent basic auth, XMLRPC through nginx and WebDAV on completed downloads, you can populate .htpasswd files with the following command:

docker run --rm -it httpd:2.4-alpine htpasswd -Bbn <username> <password> >> $(pwd)/passwd/webdav.htpasswd

Htpasswd files used:

  • rpc.htpasswd: XMLRPC through nginx
  • rutorrent.htpasswd: ruTorrent basic auth
  • webdav.htpasswd: WebDAV on completed downloads

Bootstrap config .rtlocal.rc

When rTorrent is started the bootstrap config /etc/rtorrent/.rtlocal.rc is imported. This configuration cannot be changed unless you rebuild the image or overwrite these elements in your .rtorrent.rc. Here are the particular properties of this file:

  • system.daemon.set = true: Launcher rTorrent as a daemon
  • A config layout for the rTorrent's instance you can use in your .rtorrent.rc:
    • cfg.basedir: Home directory of rtorrent (/data/rtorrent/)
    • cfg.download: Download directory (/downloads/)
    • cfg.download_complete: Completed downloads (/downloads/complete/)
    • cfg.download_temp: Downloads in progress (/downloads/temp/)
    • cfg.logs: Logs directory (/data/rtorrent/log/)
    • cfg.session: Session directory (/data/rtorrent/.session/)
    • cfg.watch: Watch directory for torrents (/data/rtorrent/watch/)
    • cfg.rundir: Runtime data of rtorrent (/var/run/rtorrent/)
  • d.data_path: Config var to get the full path of data of a torrent (workaround for the possibly empty d.base_path attribute)
  • directory.default.set: Default directory to save the downloaded torrents (cfg.download_temp)
  • session.path.set: Default session directory (cfg.session)
  • PID file to /var/run/rtorrent/rtorrent.pid
  • network.scgi.open_local: SCGI local socket and make it group-writable and secure
  • network.port_range.set: Listening port for incoming peer traffic (50000-50000)
  • dht.port.set: UDP port to use for DHT (6881)
  • log.open_file: Default logging to /data/rtorrent/log/rtorrent.log
    • Log level can be modified with the environment variable RT_LOG_LEVEL
    • rpc_events are logged be default
    • To log executed commands, add the environment variable RT_LOG_EXECUTE
    • To log XMLRPC queries, add the environment variable RT_LOG_XMLRPC

Override or add a ruTorrent plugin/theme

You can add a plugin for ruTorrent in /data/rutorrent/plugins/. If you add a plugin that already exists in ruTorrent, it will be removed from ruTorrent core plugins and yours will be used. And you can also add a theme in /data/rutorrent/themes/. The same principle as for plugins will be used if you want to override one.

⚠️ Container has to be restarted to propagate changes

Edit a ruTorrent plugin configuration

As you probably know, plugin configuration is not outsourced in ruTorrent. Loading the configuration of a plugin is done via a conf.php file placed at the root of the plugin folder. To solve this issue with Docker, a special folder has been created in /data/rutorrent/plugins-conf to allow you to configure plugins. For example to configure the diskspace plugin, you will need to create the /data/rutorrent/plugins-conf/diskspace.php file with your configuration:

<?php

$diskUpdateInterval = 10;	// in seconds
$notifySpaceLimit = 512;	// in Mb
$partitionDirectory = null;	// if null, then we will check rtorrent download directory (or $topDirectory if rtorrent is unavailable)
				// otherwise, set this to the absolute path for checked partition. 

⚠️ Container has to be restarted to propagate changes

Increase Docker timeout to allow rTorrent to shutdown gracefully

After issuing a shutdown command, Docker waits 10 seconds for the container to exit before it is killed. If you are a seeding many torrents, rTorrent may be unable to gracefully close within that time period. As a result, rTorrent is closed forcefully and the lockfile isn't removed. This stale lockfile will prevent rTorrent from restarting until the lockfile is removed manually.

The timeout period can be extended by either adding the parameter -t XX to the docker command or stop_grace_period: XXs in compose.yml, where XX is the number of seconds to wait for a graceful shutdown.

WAN IP address

WAN_IP is the public IP address sent to the tracker. In the majority of cases you don't need to set it as it will be automatically determined by the tracker.

But it can be sometimes required to enforce the public IP address when you are behind a VPN where an erroneous IP is sometimes reported.

You can also use the WAN_IP_CMD environment variable to specify a command to resolve your public IP address. Here are some commands you can use:

  • dig +short myip.opendns.com @resolver1.opendns.com
  • curl -s ifconfig.me
  • curl -s ident.me

Configure rTorrent session saving

RT_SESSION_SAVE_SECONDS is the seconds between writing torrent information to disk. The default is 3600 seconds which equals 1 hour. rTorrent has a bad default of 20 minutes. Twenty minutes is bad for the lifespan of SSDs and greatly reduces torrent throughput.

It is no longer possible to lose torrents added through ruTorrent on this docker container. Only torrent statistics are lost during a crash. (Ratio, Total Uploaded & Downloaded etc.)

Higher values will reduce disk usage, at the cost of minor stat loss during a crash. Consider increasing to 10800 seconds (3 hours) if running thousands of torrents.

Upgrade

To upgrade, pull the newer image and launch the container:

docker compose pull
docker compose up -d

Contributing

Want to contribute? Awesome! The most basic way to show your support is to star the project, or to raise issues. You can also support this project by becoming a sponsor on GitHub or by making a Paypal donation to ensure this journey continues indefinitely!

Thanks again for your support, it is much appreciated! 🙏

License

MIT. See LICENSE for more details.

More Repositories

1

WindowsSpyBlocker

Block spying and tracking on Windows
Go
4,186
star
2

diun

Receive notifications when an image is updated on a Docker registry
Go
2,073
star
3

docker-jetbrains-license-server

JetBrains License Server Docker image
Dockerfile
1,241
star
4

swarm-cronjob

Create jobs on a time-based schedule on Docker Swarm
Go
641
star
5

csgo-server-launcher

Counter-Strike Global Offensive Dedicated Server Launcher
Shell
580
star
6

docker-fail2ban

Fail2ban Docker image
Dockerfile
542
star
7

docker-samba

Samba Docker image
Dockerfile
451
star
8

ftpgrab

Grab your files periodically from a remote FTP or SFTP server easily
Go
438
star
9

ghaction-github-pages

:octocat: GitHub Action to deploy to GitHub Pages
TypeScript
408
star
10

nodejs-portable

Node.js portable on Windows
Go
385
star
11

ghaction-import-gpg

GitHub Action to import a GPG key
TypeScript
291
star
12

docker-cloudflared

Cloudflared proxy-dns Docker image
Dockerfile
266
star
13

ghaction-docker-buildx

:octocat: GitHub Action to set up Docker Buildx
TypeScript
233
star
14

docker-nextcloud

Nextcloud Docker image
Dockerfile
213
star
15

ddns-route53

Dynamic DNS for Amazon Route 53 on a time-based schedule
Go
203
star
16

docker-firefox-syncserver

Firefox Sync Server Docker image
Dockerfile
188
star
17

undock

Extract contents of a container image in a local folder
Go
170
star
18

docker-matomo

Matomo (formerly Piwik) Docker image
Dockerfile
161
star
19

docker-flarum

Flarum Docker image
Dockerfile
157
star
20

ghaction-virustotal

GitHub Action to upload and scan files with VirusTotal
TypeScript
149
star
21

xgo

Go CGO cross compiler
Shell
145
star
22

ghaction-github-labeler

:octocat: GitHub Action to manage labels on GitHub
TypeScript
123
star
23

firefox-history-merger

Merge Firefox history and repair missing favicons with ease
Go
87
star
24

docker-msmtpd

Lightweight SMTP relay Docker image using msmtpd
Dockerfile
72
star
25

docker-osxcross

MacOSX cross toolchain as Docker image
Dockerfile
71
star
26

ghaction-chocolatey

:octocat: GitHub Action for Chocolatey, the package manager for Windows
Dockerfile
67
star
27

docker-qbittorrent

qBittorrent Docker image
Dockerfile
65
star
28

ghaction-container-scan

GitHub Action to check for vulnerabilities in your container image
TypeScript
58
star
29

ghaction-github-runtime

GitHub Action to expose GitHub runtime to the workflow
Dockerfile
56
star
30

geoip-updater

Download and update MaxMind's GeoIP2 databases on a time-based schedule
Go
55
star
31

dokuwiki-plugin-syntaxhighlighter4

SyntaxHighlighter4 plugin for DokuWiki
PHP
53
star
32

ghaction-xgo

:octocat: GitHub Action for xgo, a Golang CGO cross compiler
TypeScript
52
star
33

docker-unbound

Unbound Docker image
Dockerfile
50
star
34

git-rewrite-author

Rewrite authors / commiters history of a git repository with ease
Go
48
star
35

ghaction-upx

GitHub Action for UPX, the Ultimate Packer for eXecutables
TypeScript
48
star
36

docker-docker

Docker in Docker (DinD) image
Dockerfile
47
star
37

docker-pure-ftpd

Pure-FTPd Docker image based on Alpine Linux with MySQL, PostgreSQL and LDAP support
Dockerfile
47
star
38

goxx

Go CGO cross-compiler Docker image
Shell
43
star
39

CwsMailBounceHandler

📬 PHP class to help webmasters handle bounce-back, feedback loop and ARF mails in standard DSN
PHP
41
star
40

docker-dokuwiki

DokuWiki Docker image
Dockerfile
38
star
41

docker-healthchecks

Healthchecks Docker image
Dockerfile
38
star
42

ghaction-dump-context

GitHub Action composite to dump context
37
star
43

rocketchat-uptimerobot

Uptime Robot integration for Rocket.Chat
JavaScript
34
star
44

goreleaser-xx

Cross compilation helper for GoReleaser
Go
33
star
45

ghaction-github-status

GitHub Action to check GitHub Status in your workflow
TypeScript
33
star
46

aetraymenu

Aestan Tray Menu
Pascal
33
star
47

docker-alpine-s6

Alpine Linux with s6 overlay
Dockerfile
33
star
48

ghaction-dockerhub-mirror

GitHub Action to mirror a DockerHub repo to another registry
30
star
49

docker-linguist

GitHub Linguist Docker image
HCL
27
star
50

artifactory-cleanup

Cleanup artifacts on Jfrog Artifactory with advanced settings
Go
27
star
51

docker-7zip

7-Zip Docker image
Dockerfile
26
star
52

IconsRefresh

Refresh icons on Desktop, Start Menu and Taskbar
Go
26
star
53

ghaction-setup-docker

GitHub Action to set up (download and install) Docker CE
TypeScript
19
star
54

docker-ejtserver

EJT License Server Docker image
Dockerfile
19
star
55

yasu

Yet Another Switch User
Dockerfile
17
star
56

docker-rrdcached

RRDcached Docker image
Dockerfile
17
star
57

travis-wait-enhanced

Prevent Travis CI from thinking a long-running process has stalled
Go
17
star
58

ghaction-setup-containerd

GitHub Action to set up containerd
TypeScript
16
star
59

login-servers-enhanced

Fork of the official login-servers Adminer plugin with enhancements
PHP
16
star
60

docker-n8n

n8n Docker image
Dockerfile
15
star
61

ghaction-hugo

:octocat: GitHub Action for Hugo, the world's fastest framework for building websites
TypeScript
13
star
62

docker-svn2git-mirror

🐳 Docker image to mirror SVN repositories to Git periodically
Dockerfile
13
star
63

CwsShareCount

PHP class to get social share count for Delicious, Facebook, Google+, Linkedin, Pinterest, Reddit, StumbleUpon and Twitter.
PHP
13
star
64

docker-allhands2-buildx-bake

buildx bake demo @ Docker Community All-Hands #2
HCL
13
star
65

crazy-max

12
star
66

gonfig

Lightweight config handling for Go
Go
11
star
67

ghaction-docker-status

GitHub Action to check Docker system status in your workflow
TypeScript
10
star
68

docker-spliit

Spliit Docker image
Dockerfile
10
star
69

docker-artifactory

JFrog Artifactory Docker images
10
star
70

docker-shodan

Shodan Docker image
HCL
10
star
71

echo-ipfilter

Middleware that provides ipfilter support for echo framework
Go
10
star
72

expect-nt

Fork of Expect for Windows NT by Gordon Chaffee
C
8
star
73

gotestlist

List tests in the given Go packages
Go
8
star
74

dockerfile

Official Dockerfile frontend that enables building Dockerfiles with BuildKit
Go
8
star
75

ghaction-github-release

GitHub Action for creating GitHub Releases
TypeScript
7
star
76

CwsCaptcha

PHP class to generate a captcha to avoid spam.
PHP
6
star
77

crazy-max.github.io

Homepage
HTML
6
star
78

CwsDump

PHP class to replace var_dump(), print_r() based on the Xdebug style.
PHP
6
star
79

CwsCrypto

PHP class for password hashing with multi encryption methods
PHP
6
star
80

CwsSession

PHP class to manipulate sessions. Data are securely encrypted and sessions are stored in database.
PHP
5
star
81

buildkit-nofrontend

Go
5
star
82

Killer

Kill a program by process name and clean-up notify and tray icons
C#
5
star
83

rtorrent-launcher

🚀 A simple bash script to launch rtorrent as a daemon
Shell
4
star
84

docker-snmpd

🐳 SNMP daemon Docker image based on Alpine Linux
Dockerfile
4
star
85

dokuwiki-plugin-syntaxhighlighter3

📝 Fork of SyntaxHighlighter3 plugin for DokuWiki
CSS
4
star
86

docker-loop

Simple loop for dummy services
Dockerfile
4
star
87

docker-syntaxhighlighter

🐳 Docker image to build SyntaxHighlighter javascript plugin
Dockerfile
4
star
88

rocketchat-xray

JFrog Xray integration for Rocket.Chat
JavaScript
4
star
89

rocketchat-appveyor

AppVeyor integration for Rocket.Chat
JavaScript
4
star
90

CwsDebug

PHP class to output additional messages for debug
PHP
4
star
91

docker-syspass

🐳 sysPass Docker image based on Alpine Linux
Dockerfile
4
star
92

shares-erasor

A DOS Batch script to remove all shares and disable auto shares on Windows systems.
Shell
4
star
93

IOPriority

Fork of IO Priority
C#
3
star
94

docker-inboxen

🐳 Inboxen Docker image based on Alpine Linux
Dockerfile
3
star
95

rocketchat-microbadger

MicroBadger integration for Rocket.Chat
JavaScript
3
star
96

CwsCurl

A flexible wrapper PHP class for the cURL extension.
PHP
3
star
97

geass

A multi-user front-end client for rTorrent with many features
3
star
98

CwsOvhLogsDownloader

PHP class to download the Apache access and error, FTP, CGI, Out and SSH logs available on http://logs.ovh.net from a shared hosting.
PHP
3
star
99

ama

Ask me Anything!
2
star
100

crossfit-reader

💳 Card reader application for ACR122U device affiliate to the Crossfit Nancy booking application
Java
2
star