Container image bundling aria2, the AriaNg single-page UI, nginx, and a watch-directory workflow that feeds new torrents to aria2 via JSON-RPC.
6800.docker build (pin with ARIANG_VERSION=<tag>)./data) and watch directory (/watch) whose ownership matches the requested UID/GID..torrent files via aria2p add, renaming each to .added after submission.aria2 with a generated password persisted under /config), while /jsonrpc stays exposed only via the shared secret for AriaNg and other clients./config so restarts reuse credentials unless you explicitly force regeneration.mkbrr CLI (from autobrr/mkbrr) via Alpine’s edge/testing repository so you can craft torrents directly inside the container.docker build -t aria2-web-watch .
--build-arg ARIANG_VERSION=<tag> to pin AriaNg to a specific release instead of latest.nginx:stable-alpine; no private registry access required.docker volume create aria2-config
docker run -p 80:80 -p 6800:6800 \
-e RPC_SECRET="your-secret" \
-e PUID=1000 -e PGID=1000 \
-v aria2-config:/config \
aria2-web-watch
http://localhost/ for AriaNg; it connects to aria2 through nginx at http://localhost/jsonrpc.6800 is optional unless you need direct RPC access from outside the container./data and /watch live inside the container filesystem by default; override via DOWNLOAD_DIR and WATCH_DIR only if you truly need host mounts./etc/aria2/aria2.conf.template into ARIA2_CONF before appending runtime values like the RPC secret, download path, and session file./jsonrpc proxy is enabled by default so AriaNg can reach aria2 via the same origin; set ENABLE_RPC_PROXY=false to disable the nginx proxy if you never want the RPC exposed./ariang-autoconfig.js) seeds AriaNg’s browser storage the first time the UI loads so it automatically targets /jsonrpc. Disable it with ENABLE_ARIANG_AUTOCONFIG=false if you prefer to manage settings manually.RPC_SECRET and Basic Auth password (or uses values you provide), stores them under /config, and reuses them on future starts. Set FORCE_RANDOM_RPC_SECRET=true or FORCE_RANDOM_WEBUI_PASSWORD=true if you need one-off rotations.docker logs <container>) if you rely on the defaults; otherwise, set explicit RPC_SECRET and WEBUI_PASSWORD values for deterministic deployments.BT_LISTEN_PORT (default 6881) and PEER_ID_PREFIX (default A2), and adjust log verbosity with ARIA2_LOG_LEVEL. aria2 logs stream to Docker logs because the process writes directly to stdout./watch are ignored by default (WATCH_EXCLUDE_REGEX), avoiding Syncthing metadata and similar helper folders./healthz issues a loopback JSON-RPC call (aria2.getVersion) to verify nginx, aria2, and the secret are all working before returning {"status":"ok"}—ideal for Docker/K8s readiness checks./config (or override SECRETS_DIR) if you want those credentials to persist outside the container filesystem.Use docker-compose.yml as a starting point, customizing environment variables to taste:
services:
aria2-web-watch:
image: schedion/aria2-web-watch:latest
# build: . # Uncomment to build locally
environment:
RPC_SECRET: "changeme" # optional; generated & stored if omitted
WEBUI_USER: "aria2"
WEBUI_PASSWORD: "changeme" # optional; generated & stored if omitted
PUID: "1000"
PGID: "1000"
ENABLE_RPC_PROXY: "true"
ENABLE_ARIANG_AUTOCONFIG: "true"
BT_LISTEN_PORT: "6881"
PEER_ID_PREFIX: "A2"
ARIA2_LOG_LEVEL: "notice"
WATCH_EXCLUDE_REGEX: "(^|/)\\."
SKIP_DIR_OWNERSHIP: "false"
# DOWNLOAD_DIR: "/data"
# WATCH_DIR: "/watch"
# SECRETS_DIR: "/config"
# RPC_SECRET_FILE: "/config/rpc-secret"
# WEBUI_PASSWORD_FILE: "/config/webui-password"
ports:
- "80:80"
- "6800:6800"
volumes:
- aria2-config:/config
# - ./aria2.conf:/config/aria2.conf.template:ro
healthcheck:
test: ["CMD", "curl", "-fsS", "http://localhost/healthz"]
interval: 30s
timeout: 5s
retries: 3
volumes:
aria2-config:
docker compose up -d
| Variable | Default | Purpose |
|---|---|---|
RPC_SECRET | (empty) | Appended to aria2.conf as rpc-secret, enabling authenticated JSON-RPC calls from AriaNg. |
PUID / PGID | 1000 | UID and GID assigned to the runtime user; used to chown download/watch directories when starting as root. |
DOWNLOAD_DIR | /data | Directory aria2 writes finished files into; bind mount for persistence. |
WATCH_DIR | /watch | Directory watched for .torrent files; new files are queued via aria2p. |
WATCH_EXCLUDE_REGEX | `(^ | /).` |
ARIA2_CONF | /config/aria2.conf | Effective aria2 configuration file written at container start (stored in /config). |
ARIA2_TEMPLATE | /config/aria2.conf.template | Template copied into ARIA2_CONF before runtime overrides. If missing, the built-in template populates this path on first boot. |
ARIA2_SESSION | /config/aria2.session | Session file used by aria2 to resume downloads. Lives under /config by default. |
ENABLE_RPC_PROXY | true | When true, nginx proxies /jsonrpc to aria2 so AriaNg (or other clients) can use the same origin. Set to false to avoid exposing the RPC API via nginx. |
BT_LISTEN_PORT | 6881 | Port aria2 listens on for BitTorrent peers. |
PEER_ID_PREFIX | A2 | Prefix appended to aria2’s peer ID for BitTorrent traffic. |
WEBUI_USER | aria2 | Username required by nginx’s Basic Auth when visiting the AriaNg UI. |
WEBUI_PASSWORD | (persisted random) | Password used by nginx’s Basic Auth. Leave unset to auto-generate once (stored under WEBUI_PASSWORD_FILE). |
WEBUI_PASSWORD_FILE | $SECRETS_DIR/webui-password | File containing the persisted Basic Auth password. |
WEBUI_HTPASSWD | /etc/nginx/.htpasswd | Location of the generated htpasswd file referenced by nginx. Override if you need to manage credentials externally. |
SECRETS_DIR | /config | Directory where generated credentials (RPC + Basic Auth) are stored. Mount it for persistence. |
RPC_SECRET_FILE | $SECRETS_DIR/rpc-secret | File containing the persisted RPC secret. |
FORCE_RANDOM_RPC_SECRET | false | When true, RPC_SECRET is regenerated each start and stored. Leave false to reuse the persisted secret or respect RPC_SECRET. |
FORCE_RANDOM_WEBUI_PASSWORD | false | When true, the Basic Auth password is regenerated each start and stored. |
SKIP_DIR_OWNERSHIP | true | Set to false only if you want the entrypoint to chown -R /data, /watch, and the session directory (useful when binding host paths). Leaves permissions untouched by default. |
ARIA2_LOG_LEVEL | notice | Controls aria2’s --log-level / --console-log-level (e.g., warn, info, debug). |
ENABLE_ARIANG_AUTOCONFIG | true | Injects /ariang-autoconfig.js, which seeds AriaNg’s localStorage with sane defaults (auto-connecting to /jsonrpc) if no settings are stored yet. Turn off if you intend to supply your own UI build or prefer manual setup. |
ARIANG_VERSION (build arg) | latest | GitHub release tag fetched during docker build. |
Mount or override the directories referenced above to keep state outside the container. The entrypoint creates missing directories and session files before starting services.
ENABLE_ARIANG_AUTOCONFIG=true, the entrypoint injects an inline config block (exposing runtime data like the generated RPC secret) followed by /ariang-autoconfig.js. The script runs before AriaNg initializes and creates or updates localStorage['AriaNg.Options'], ensuring the host/port/protocol and base64-encoded secret point to /jsonrpc on the same origin.ENABLE_ARIANG_AUTOCONFIG=false; the script is removed and the UI will prompt you for RPC details.AriaNg.* entries from localStorage) and reload the page so /ariang-autoconfig.js can repopulate them..torrent file into the watch directory (default /watch).inotifywait emits an event and the watcher submits the torrent via aria2p add.<original>.added so you have a quick audit trail; failures are logged but left untouched.Watch directory handling and inotify-based queuing are inspired by mushanyoung/aria2-watching. Consult the aria2 project for advanced JSON-RPC options and authentication settings.
.gitattributes; ensure your Git tooling honors those settings to avoid cross-platform conflicts.docker build and docker run locally when changing the Dockerfile, entrypoint, or configs.The container installs mkbrr from Alpine’s testing repository under /usr/local/bin/mkbrr. Run it via docker exec whenever you need to create or inspect torrents, for example:
docker exec -it aria2-web-watch mkbrr create --path /data/myfile.iso
Whenever Alpine updates mkbrr you’ll pick up the new version on the next image rebuild; no extra build arguments required.
Content type
Image
Digest
sha256:f79e88706…
Size
64 MB
Last updated
7 months ago
docker pull schedion/aria2-web-watch