Skip to content

qBittorrent in Container Manager on a Synology NAS

Important or Recent Updates
Historic UpdatesDate
Fresh new guide by popular demand28/09/2023
Updated with new steps to obtain and change WebUI password21/11/2023
Issue with passwords has been fixed in 4.6.2 so removed tty line from yaml29/11/2023
Historic Updates

What is qBittorrent?

qBittorrent is a torrent downloader used to both manage torrent downloading and seeding.

If you are looking to combine a VPN with this set up see the GlueTUN guide on the left Menu

Let’s Begin

In this guide I will take you through the steps to get qBittorrent up and running in Docker

In order for you to successfully use this guide please complete the three preceding guides

Folder Setup

Let’s start by getting some folders set up for the containers to use. Open up File Station create the following.

Folders
/docker/projects/qbit-compose
/docker/qbittorrent

Container Manager

Next we are going to set up a ‘Project’ in Container Manager, a project is used when you want one or more to all be loaded together and uses Docker Compose to do this.

Open up Container Manager and click on Project then on the right-hand side click ‘Create’

In the next screen we will set up our General Settings, enter the following:

SectionSetting
Project Name:qbit-project
Path:/docker/projects/qbit-compose
Source:Create docker-compose.yml

Next we are going to drop in our docker compose configuration copy all the code in the box below and paste it into line ‘1’ just like the screenshot


YAML
services:
  qbittorrent:
    image: linuxserver/qbittorrent:latest
    container_name: qbittorrent
    environment:
      - PUID=1234 #CHANGE_TO_YOUR_UID
      - PGID=65432 #CHANGE_TO_YOUR_GID
      - TZ=Europe/London #CHANGE_TO_YOUR_TZ
      - WEBUI_PORT=8090
    volumes:
      - /volume1/docker/qbittorrent:/config
      - /volume1/data/torrents:/data/torrents
    ports:
      - 9854:9854/tcp # Forwarded Port on Router TCP
      - 9854:9854/udp # Forwarded Port on Router TCP
      - 8090:8090/tcp # port for qbittorrent webui
    network_mode: synobridge
    restart: always

Environment Variables

We are now going to amend some key variables to make sure the container has access to our folders and also knows where we are in the world. Don’t change any other settings other than those I mention.

VariableValue
PUID(required) The UID you obtained in the user setup guide
PGID(required) The GID you obtained in the user setup guide
TZ(required) Your timezone wikipedia.org/wiki/List_of_tz_database_time_zones

Ports

Nothing to change here, the webui will run on port 8090 and the ports we will be using for the torrent protocol will be 9854 for TCP and UDP.

Volumes

By default, I have assumed you have your config files stored on /volume1 if these are located on another volume amend this line accordingly.

Click ‘Next’

You do not need to enable anything on the ‘Web portal settings’ screen click ‘Next’ again

On the final screen click Done which will begin the download of the container images and once downloaded they will be launched!

The images will now be downloaded and extracted. You should see ‘Code 0’ when it has finished.

You will now see your qbit-project running with a green status on the left-hand side.

Firewall Exceptions

(Skip if you don’t have the Firewall configured)

If you have enabled and configured the Synology Firewall you will need to create exceptions for any containers that have a Web UI or have any incoming or outgoing connections. This section covers the basics of how to add these. (Please note this is a generic section and will not show the specific ports used in this guide however it applies in the same way)

Also, I would like to refer people to the great guide on getting the Firewall correctly configured over on WunderTechs site.

Head into the Control Panel> Security > Firewall, from here click Edit Rules for the profile you set up when you enabled the Firewall.

Next click on Create and you will see the screen below. Source IP and Action will be automatically selected to All and Allow, I will leave it up to you as to your own preference on whether you want to lock down specific Source IPs from having access. In this example we will leave as All.

You will now choose ‘Custom‘ and then the Custom button

Now select Destination from the drop-down menu, most web based containers require TCP access but check the guide as it will show the port and protocol. Then add comma separated ports. Then press OK.

Click OK a couple of times to get back to the main screen. You will see by default the new rule is added to the bottom of the list. You must always have your Block All rule last in the list as the rules are applied top down so move your container up.

You have now completed the Firewall changes and can continue with the guide.

Changing the default WebUI login and password

If you skip this step you won’t be able to log in.

Now the container has started open it in the Docker UI and go to the Log tab. Within the logs you will see the login details

Now before doing any more of the guide go to the Web UI by going to the IP of your NAS followed by port 8090 and log in. Then on the WebUI tab change the defaults to your own and save them.

Now continue on..

Router Port Forwarding

As you can imagine there are thousands of possible router configs out there, so you will need to check the manual for your own.

Essentially you need to Port Forward port 9854 TCP and UDP to your NAS IP address. This will make you connectable for all peers. Most routers support UPnP or NAT-PNP which will automatically set up ports however it’s usually more secure to turn these off and do it manually.

Final qBittorrent steps

As we have used /data/torrents as the mount point for our downloads we need to make sure qBittorrent uses this same file path.

We need to change the file paths by editing the qBittorrent config file, before doing this stop both of the containers. Do this by selecting the Project from the main UI and under Action selecting ‘Stop’.

You can edit this file in a number of ways, but to keep the guide OS-agnostic we will be using the Synology Text Editor package which can be installed via Package Center.

Open Text Editor and browse to /docker/qbittorrent/qbittorrent and open the qBittorrent.conf then edit the file in line with the table below, once amended save the changes.

Original ValueNew Value
Session\DefaultSavePath=/downloads/Session\DefaultSavePath=/data/torrents/completed
Session\TempPath=/downloads/incomplete/Session\TempPath=/data/torrents/incoming/
Downloads\SavePath=/downloads/Downloads\SavePath=/data/torrents/completed
Downloads\TempPath=/downloads/incomplete/Downloads\TempPath=/data/torrents/incoming/

You can now bring the containers back up again by starting the Project.

Once the containers are running you can log into the Web UI by going to the IP of your NAS followed by port 8090

e.g. 192.168.0.30:8090

Log in with the username and password you created earlier.

Now you are in the UI click on settings cog at the top of the screen, we are going to change one more directory which is the watched folder to /data/torrents/watch. You can also turn on the option ‘keep incomplete torrents in:’ which should already have /data/torrents/incoming’ prefilled.

Next we are going to set a command to run when each torrent finishes to automatically extract any .rar files (Note if you have any issues with this I would recommend using Unpackerr the guide is on the menu)

Scroll down in the options to the ‘Run external program on torrent completion’ and enter the below, it tells qbittorrent to run unrar and extract the file to the same save path as the original file. This will not delete anything, so you can continue seeding.

unrar x "%D/*.r*" "%D/"

Connection Settings

The last step is to tell qBittorrent to use the correct port for communication enter 9854 in the Listening Port.

I am not going to walk through all the other settings as you can customise these as you wish.

That’s it.


FAQs

More will be added as questions come up


Looking for some help, join our Discord community

If you are struggling with any steps in the guides or looking to branch out into other containers join our Discord community!

Buy me a beverage!

If you have found my site useful please consider pinging me a tip as it helps cover the cost of running things or just lets me stay hydrated. Plus 10% goes to the devs of the apps I do guides for every year.

Published inDockerDownload Tools 7.2Synology

49 Comments

  1. Michael Michael

    Hi Doc,
    been following your great guides to the comma, but all torrents get stalled or are terribly slow download rates (<10 kB/s).
    – there are no errors in the qbit container log
    – I am not using any VPN
    – I disabled the Syno firewall for testing

    Do you have any idea what might be wrong? Thank you for your work!

      • Michael Michael

        Thanks for your reply!

        Funnily enough, I already used the Ubuntu torrent for testing earlier.
        qBit is configured to use port 9854.
        Port forwarding is active for 9854 on the router (and the NAS for that matter, if the firewall is enabled). However, I cannot activate any of the firewalls without the torrent stalling.

        • Dr_Frankenstein Dr_Frankenstein

          If its the Firewall you need to create an exception for port 9854 in line with the guide that should allow traffic to flow.

  2. clint clint

    Thank you so much for this guide! I followed it exactly and got it up and running without issues. I have a question regarding seeding and the file structure. I didn’t want to keep all the different categories of files (movies, tv shows, books etc.) lumped together in the completed folder to seed since I want to seed as long as possible on some files rather than moving them to the “media” folders after awhile. When I save the file to another location outside of the “completed” folder, the file remains in the “incoming” folder once it’s completed. However, I created folders for “tv” “movies” etc. inside the “completed “folder and saved to those and that seemed to allow me to separate the categories and still be seeding. For example, if it’s a movie, when I add the torrent it obviously wants to save in “data/torrents/completed” by default, but since I have a “movies” section in the “completed” folder I add “/movies” to the end of “data/torrents/completed” and the movie successfully saves to there. My question is am I screwing something up doing it this way?

    • Dr_Frankenstein Dr_Frankenstein

      You should be setting up if not already in place categories for the types, this should already be happening, for example Sonarr > Settings > Download Clients you can set a category, this will mean once the file has completed downloading it will move to /completed/tv-sonarr, it will remain seeding and Sonarr will Atomic Move / Hardlink the file so it appears in /data/media. So don’t manually do it make the apps do it.

  3. kim kim

    hi… i dont have a folder name Project in Container Manager > Open up Container Manager and click on Project then on the right-hand side click ‘Create’

  4. Darrick Darrick

    Just a quick question, why are the firewall ports open for 1234 and 9876 when the port used is 9854?

    • Dr_Frankenstein Dr_Frankenstein

      The firewall section is generic across all guides as noted at the start of that section, it saves me having the same information to update across every guide you just change out the ports used in the Guide.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

drfrankenstein.co.uk – writing Synology Docker Guides since 2016 – Join My Discord!