Устанавливаем qBittorrent с общим доступом к загрузкам по протоколу SMB на Docker


создаем файл /etc/docker/qbittorrent/Dockerfile

FROM oraclelinux:8.6

RUN \
dnf install -y epel-release && \
dnf install -y openssl qbittorrent-nox samba supervisor && \
groupadd -g 99999 qbittorrent && \
useradd -m -u 99999 -g 99999 qbittorrent && \
mkdir -p /home/qbittorrent/{.cache,.config/qBittorrent,.local,downloads,torrents} && \
openssl req -x509 -newkey rsa:4096 -days 365 -subj "/CN=qbittorrent.domain.lan" \
  -keyout /home/qbittorrent/.config/qBittorrent/private.key \
  -out /home/qbittorrent/.config/qBittorrent/public.cer -nodes && \
chown -R qbittorrent:qbittorrent /home/qbittorrent/{.cache,.config,.local,downloads,torrents}

COPY --chown=qbittorrent:qbittorrent qBittorrent.conf /home/qbittorrent/.config/qBittorrent/
COPY smb.conf /etc/samba/smb.conf
COPY supervisor.ini /etc/supervisord.d/

ENTRYPOINT /usr/bin/supervisord -n

создаем файл /etc/docker/qbittorrent/qBittorrent.conf

[LegalNotice]
Accepted=true

[Preferences]
WebUI\Port=8888
WebUI\HTTPS\Enabled=true
WebUI\HTTPS\CertificatePath=/home/qbittorrent/.config/qBittorrent/public.cer
WebUI\HTTPS\KeyPath=/home/qbittorrent/.config/qBittorrent/private.key
Downloads\SavePath=/home/qbittorrent/downloads/
Downloads\TorrentExportDir=/home/qbittorrent/torrents/

создаем файл /etc/docker/qbittorrent/smb.conf

[global]
security = user
server role = standalone
server min protocol = SMB2
server max protocol = SMB3
passdb backend = tdbsam:/etc/samba/passdb.tdb
log level = 1

[downloads]
path=/home/qbittorrent/downloads
guest ok = no
writable = yes
browsable = yes
create mask = 0700
directory mask = 0700

[torrents]
path=/home/qbittorrent/torrents
guest ok = no
writable = yes
browsable = yes
create mask = 0700
directory mask = 0700

создаем файл /etc/docker/qbittorrent/supervisor.ini

[program:qbittorrent]
command=/usr/bin/qbittorrent-nox
user=qbittorrent
environment=HOME="/home/qbittorrent",USER="qbittorrent"
autostart=true
autorestart=true
stdout_logfile=/var/log/qbittorrent.out
stderr_logfile=/var/log/qbittorrent.err

[program:samba]
command=/usr/sbin/smbd --foreground --no-process-group
autostart=true
autorestart=true
stdout_logfile=/var/log/samba.out
stderr_logfile=/var/log/samba.err

создаем файл /etc/docker/qbittorrent/docker-compose.yml

version: '3.8'

networks:
  net:
    ipam:
      config:
        - subnet: 192.168.100.0/24

volumes:
  cache:
  config:
  local:
  downloads:
  torrents:
  samba:
  supervisor:

services:
  qbittorrent:
    container_name: qbittorrent
    build:
      context: .
    volumes:
      - cache:/home/qbittorrent/.cache
      - config:/home/qbittorrent/.config
      - local:/home/qbittorrent/.local
      - downloads:/home/qbittorrent/downloads
      - torrents:/home/qbittorrent/torrents
      - samba:/etc/samba
      - supervisor:/etc/supervisor
    networks:
      net:
    ports:
      - 8888:8888
      - 445:445

создаем контейнер

docker-compose -f /etc/docker/qbittorrent/docker-compose.yml up -d

изменяем пароль для доступа к общим папкам

docker exec --user root -t -i qbittorrent smbpasswd -a qbittorrent

Добавить комментарий