Sign inSign up

skleijkers/rtorrent-rutorrent

By skleijkers

Updated 5 days ago

RTorrent and RuTorrent image based on the image of CrazyMax with IPv6 capabilities

Image
0

1.7K

skleijkers/rtorrent-rutorrent repository overview

rTorrent & ruTorrent Docker Image with IPv6 Enabled

A custom build of rTorrent and ruTorrent based on the excellent architecture of crazymax/rtorrent-rutorrent, but with full compile-time and runtime IPv6 support enabled.


Table of Contents


Features

  • Full IPv6 & Dual-Stack Support: Both libtorrent and rtorrent compiled with --enable-ipv6 from source.
  • Dynamic Network Binding: Entrypoint script detects if the container has IPv6 enabled, dynamically configuring Nginx (listen [::]:<port>;) and rTorrent (network.bind_address.ipv6.set = ::) accordingly.
  • Run as non-root user (rtorrent user/group).
  • Multi-platform ready image.
  • Domain name resolving enhancements with c-ares and UDNS for asynchronous DNS requests.
  • 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.
  • Vendored ruTorrent GeoIP2 plugin.
  • mktorrent and DumpTorrent compiled from source.

IPv6 Capabilities

Historically, running rTorrent inside Docker with IPv6 caused crashes or connection issues due to a lack of socket-level IPv6 compile options and binding misconfigurations. This image addresses these issues by:

  1. Compiling libtorrent-rakshasa and rtorrent with --enable-ipv6.
  2. Utilizing the new rTorrent v0.16.x dual-stack network variables:
    network.bind_address.ipv4.set = 0.0.0.0
    network.bind_address.ipv6.set = ::
    network.prefer.ipv6.set = yes
    
  3. Dynamically adapting the configuration at runtime. If the container lacks an IPv6 network stack (e.g. IPv6 is disabled on the host or in the Docker daemon), the image gracefully falls back to IPv4-only binding, preventing crashes.

Build locally

You can use the provided Makefile to build and run the image:

# Build and tag the image locally (e.g., as docker.io/skleijkers/rtorrent-rutorrent:v5.3.4)
make build

# Start the docker-compose stack
make up

# Tail the logs
make logs

# Stop the stack
make down

Image

RegistryImage NameTag
Local Build / Docker Hubskleijkers/rtorrent-rutorrentv5.3.4, latest

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 (e.g., curl -s ifconfig.me)
  • MEMORY_LIMIT: PHP memory limit (default 256M, overridden to 512M in compose)
  • UPLOAD_MAX_SIZE: Upload max size (default 16M, overridden to 64M in compose)
  • 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 proxy addresses (default 0.0.0.0/32)
  • REAL_IP_HEADER: Proxy header (default X-Forwarded-For)
  • LOG_IP_VAR: Variable used to retrieve remote IP address on Nginx (default remote_addr)
  • LOG_ACCESS: Output access log (default true)
  • XMLRPC_AUTHBASIC_STRING: Basic Auth message for XMLRPC (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: Basic Auth message for ruTorrent UI (default ruTorrent restricted access)
  • RUTORRENT_PORT: ruTorrent UI port (default 8080)
  • WEBDAV_AUTHBASIC_STRING: Basic Auth message for WebDAV (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_SESSION_FDATASYNC: Force fdatasync when saving sessions (default false)
  • RT_TRACKER_DELAY_SCRAPE: Delay tracker announces at startup (default true)
  • RT_DHT_PORT: DHT UDP port (default 6881)
  • RT_INC_PORT: Incoming connection port (default 50000)
  • RT_SEND_BUFFER_SIZE: Sets default tcp wmem value (default 4M)
  • RT_RECEIVE_BUFFER_SIZE: Sets default tcp rmem value (default 4M)
  • RT_PREALLOCATE_TYPE: Sets the type of disk space preallocation (default 0 - disabled)
ruTorrent
  • RU_REMOVE_CORE_PLUGINS: Comma-separated list of core plugins to remove; set to false to disable removal.
  • RU_HTTP_USER_AGENT: HTTP user agent (default browser agent)
  • 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 (default /data/rutorrent/rutorrent.log)
  • RU_DO_DIAGNOSTIC: ruTorrent diagnostics (default true)
  • RU_CACHED_PLUGIN_LOADING: Enable rapid cached loading of ruTorrent plugins (default false)
  • RU_PLUGIN_MINIFICATION: Enable plugins minification (default true)
  • RU_SAVE_UPLOADED_TORRENTS: Save torrent files added via ruTorrent in profile directory (default true)
  • RU_OVERWRITE_UPLOADED_TORRENTS: Overwrite existing torrent files (default false)
  • RU_FORBID_USER_SETTINGS: Single user style configuration, even with webauth (default false)
  • RU_LOCALE: Default locale (default UTF8)

Volumes

  • /data: Home directory for configurations, logs, geoip, session files, etc.
  • /downloads: Target directory for in-progress and completed downloads.
  • /passwd: Contains htpasswd files (rutorrent.htpasswd, rpc.htpasswd, webdav.htpasswd) for basic auth.

Warning

Ensure all volumes are owned by the user/group defined by `PUID` and `PGID` (usually `1000:1000`). Incorrect permissions will cause the container to fail on startup.

Ports

  • 6881/udp: DHT port
  • 8080/tcp: ruTorrent HTTP Web Interface
  • 9000/tcp: WebDAV port
  • 50000/tcp / 50000/udp: Peer incoming traffic
  • 8000/tcp: XMLRPC interface (optional, exposed inside Docker network)

Usage

To run the custom image, create your directories on the host, adjust permissions, and spin up the compose stack defined in docker-compose.yml:

# Create local volume folders
mkdir -p data downloads passwd
chown -R 1000:1000 data downloads passwd

# Start the stack
docker compose up -d

Your docker-compose.yml configures a user-defined bridge network with IPv6 enabled and a Unique Local Address (ULA) subnet:

networks:
  torrent_net:
    name: torrent_net
    enable_ipv6: true
    ipam:
      config:
        - subnet: 172.28.0.0/16
        - subnet: fd00:dead:beef::/48
Command line

You can also run it using the following docker run command:

docker run -d --name rtorrent_rutorrent \
  --ulimit nproc=65535 \
  --ulimit nofile=32000:40000 \
  -p 6881:6881/udp \
  -p 8080:8080 \
  -p 9000:9000 \
  -p 50000:50000 \
  -p 50000:50000/udp \
  -v $(pwd)/data:/data \
  -v $(pwd)/downloads:/downloads \
  -v $(pwd)/passwd:/passwd \
  skleijkers/rtorrent-rutorrent:latest

Notes

IPv6 Auto-detection & Binding

At startup, the initialization script /etc/cont-init.d/03-config.sh checks for /proc/net/if_inet6.

  • If IPv6 is active, it modifies the Nginx templates to listen on [::] in addition to 0.0.0.0, and configures rTorrent to bind peer connections on ::.
  • If IPv6 is not active (e.g. host kernel has disabled IPv6), it skips these directives to ensure that Nginx and rTorrent start successfully without binding errors.

To ensure your host system allows containerized IPv6 traffic:

  1. Ensure your Docker daemon configuration (/etc/docker/daemon.json) supports IPv6:
    {
      "ipv6": true,
      "fixed-cidr-v6": "fd00:dead:beef::/48"
    }
    
  2. Enable ip6tables or routing on your host firewall if you wish to block/forward incoming external connections.
XMLRPC through nginx

XMLRPC requests are routed through Nginx on port 8000 (or local socket). Secure this interface by writing username/password entries into /passwd/rpc.htpasswd.

WebDAV

Access completed files in /downloads/complete via WebDAV on port 9000. Secure this by adding entries into /passwd/webdav.htpasswd.

Populate .htpasswd files

Populate Basic Auth htpasswd files using htpasswd or a helper container:

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

License

Derived from crazymax/rtorrent-rutorrent (MIT License). Under same MIT License.

Tag summary

Content type

Image

Digest

sha256:888e4aed9

Size

142.4 MB

Last updated

5 days ago

docker pull skleijkers/rtorrent-rutorrent