About
If you are interested, check out my other
Features
Included
- 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
- Ability to remap user and group (UID/GID)
- WAN IP address automatically resolved for reporting to the tracker
- 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 to persist specific configuration for ruTorrent plugins
From docker-compose
- Traefik as reverse proxy and creation/renewal of Let's Encrypt certificates
Environment variables
TZ: The timezone assigned to the container (default:UTC)PUID: The user id (default:1000)PGID: The group id (default:1000)WAN_IP: Public IP address reported to the tracker (default auto resolved withdig +short myip.opendns.com @resolver1.opendns.com)MEMORY_LIMIT: PHP memory limit (default:256M)UPLOAD_MAX_SIZE: Upload max size (default:16M)OPCACHE_MEM_SIZE: PHP OpCache memory consumption (default:128)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)RU_REMOVE_CORE_PLUGINS: Remove ruTorrent core plugins ; comma separated (default:erasedata,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_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, downloads, session files, log, .../passwd: Contains htpasswd files for basic auth
Ports
80: ruTorrent HTTP port6881: DHT UDP port (dht.port.set)8000: XMLRPC port through nginx over SCGI socket9000: WebDAV port on completed downloads50000: Incoming connections (network.port_range.set)
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 :
$ touch acme.json
$ chmod 600 acme.json
$ docker-compose up -d
$ docker-compose logs -fCommand line
You can also use the following minimal command :
$ docker run -d --name rtorrent-rutorrent \
--ulimit nproc=65535 nofile=32000:40000 \
-p 80:80 \
-p 6881:6881/udp \
-p 8000:8000 \
-p 9000:9000 \
-p 50000:50000 \
-v $(pwd)/data:/data \
-v $(pwd)/passwd:/passwd \
crazymax/rtorrent-rutorrent:latestNotes
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 /data/rtorrent/downloads/completed 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 crazymax/rtorrent-rutorrent:latest htpasswd -Bbn <username> <password> >> $(pwd)/passwd/webdav.htpasswd
Htpasswd files used :
rpc.htpasswd: XMLRPC through nginxrutorrent.htpasswd: ruTorrent basic authwebdav.htpasswd: WebDAV on completed downloads
Boostrap config .rtlocal.rc
When rTorrent is started the bootstrap config /etc/.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 (/data/rtorrent/downloads/)cfg.download_complete: Completed downloads (/data/rtorrent/downloads/completed/)cfg.download_temp: Downloads in progress (/data/rtorrent/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 (/run/rtorrent/)
d.data_path: Config var to get the full path of data of a torrent (workaround for the possibly emptyd.base_pathattribute)directory.default.set: Default directory to save the downloaded torrents (cfg.download_temp)session.path.set: Default session directory (cfg.session)- PID file to
/run/rtorrent/rtorrent.pid network.scgi.open_local: SCGI local socket and make it group-writable and securenetwork.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_eventsare 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
- Log level can be modified with the environment variable
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 problem 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
Upgrade
To upgrade, pull the newer image and launch the container :
docker-compose pull
docker-compose up -dHow can I help ?
All kinds of contributions are welcome
The most basic way to show your support is to star
But we're not gonna lie to each other, I'd rather you buy me a beer or two
License
MIT. See LICENSE for more details.

