How to install Sonarr Radarr and Jackett with Docker22nd March 2019
This post continues where previously How to install docker on Alpine Linux VM left, where we deployed an Alpine Linux virtual machine in a Proxmox host, created a docker user and installed docker engine.
Sonarr, Radarr and Jackett are necessary additions for a complete HTPC setup and serve as a nice example for anyone wishing to learn Docker. The whole proccess consists of Sonarr and Radarr searching for media files using Jackett and send the findings provided by Jackett to the download client.
The first step in this guide, setting up smb shares, is specific to Sonarr and Radarr. Then we proceed with the actual deployment of the containers.
If media folders remote then setup access to samba shares
Sonarr,Radarr and Jackett need access to the folder where the media files are, which in many cases are in a Network Attached Storage and not in the same machine as the docker host.This post will use Samba shares to a Synology NAS as an example. This step can be ignored if the media files are in the same host with Sonarr etc.
Install cifs-utils in the Alpine VM to connect as a client to smb shares:
sudo apk add cifs-utils
Make the netmount service start on boot:
sudo rc-update add netmount boot
As root create a file that contains the credentials of the remote shares:
su root vi ~/.smbcr username=nas-user password=nas-password
Change the rights of the file so it can be read only by root:
chmod 600 ~/.smbcr
Find the uid and gid of the user that will run docker:
Edit the fstab file and add the directories to be mounted:
//192.168.1.10/Synology1 /mnt/synomovies cifs uid=1000,gid=150,credentials=/root/.smbcr,_netdev,vers=2.0 0 0 //192.168.1.10/Synology2 /mnt/downloads cifs uid=1000,gid=150,credentials=/root/.smbcr,_netdev,vers=2.0 0 0 //192.168.1.10/Synology2 /mnt/tv cifs uid=1000,gid=150,credentials=/root/.smbcr,_netdev,vers=2.0 0 0
In the example we will create a separate directory on mnt/ for each content, so we need to declare the same remote path twice if two of the target folders are in the same root path.
On Alpine if vers=2.0 is not included the os is unable to mount the share:
mount error(95): Operation not supported
Also it is required to add _netdev so the mounting process will wait for the network to initialize first,especially helpful for older systems.
Exit root shell and create the directories in fstab as mount targets:
exit sudo mkdir -p /mnt/downloads /mnt/synomovies /mnt/tv
Make them accessible by the docker user:
sudo chown -R dockeras:docker /mnt/downloads sudo chown -R dockeras:docker /mnt/synomovies sudo chown -R dockeras:docker /mnt/tv
sudo mount -a df -h
Key concepts of Docker techology
Some Docker concepts for reference:
Running a docker container:
Pull an image and run or create the container based on that image, adding some options in the command.These options persist on restart.
Update a container with a newer image by removing the container and pull&run the new image.
Persistent volumes – Mapping directories:
Data inside a docker container is lost on restart. Include in the options, the host directories where data will persist.That way we can remove and update the container without losing DBs or settings.
The containers have a specific directory structure.In the options we bind internal container directories to directories in the host with the -v option.
The containers have specific ports where their services are listening.In docker networking the two most common options are bridge networking and host networking.
In bridge networking the containers are isolated from the host and the ports must be exposed/ forwarded to the host.In options this is defined with -p 8080:80 which means forward port 80 of the container to port 8080 on its host.
In host networking the network stack of the containers is not isolated from the host.Which means if a container’s service is running in port 80 it is running in port 80 of the host,with the downside that you cant run two containers that are using the same ports with the –net=host option.Usefull when:
- A container needs to have many ports open and we are certain there will be no port overlap on the host.
- When we run a dockerized netflow/packet capture app which needs to proccess packets arriving to the NIC of the host.
If the host runs on a VPS and –net=host is used, the docker app is exposed to the internet, we need to regulate with the firewall of the host.
Edit configuration of dockerized app:
Configuration files in the dockerized apps can be edited with the environment variable option -e.
There is no need to pull an image and create the container separately if what we want is the newest version of an image.The run command will do this without needing our input.If there is no newer image it will use the newest we already have.If we need to roll back a version or use other builds we then use tags.
Step-by-step containers installation
After installing the docker engine described in How to install docker on Alpine Linux VM , we need to download images from docker hub. For popular media center apps some of the best are from linuxserver.io .
For the docker container installation copy and paste the command in the cli one line at a time and change if needed.
For the user dockeras in the example:
and based on the mounts on host machine:
the configuration will be:
docker run -d \ --name=radarr \ --restart=unless-stopped \ -v /home/dockeras/radarr:/config \ -v /mnt/downloads:/downloads \ -v /mnt/synomovies:/movies \ -e TZ='Europe/Athens' \ -e PGID=150 -e PUID=1000 \ -p 7878:7878 \ linuxserver/radarr
- create and run a container.
- give it the name radarr.
- define restart policy.e.g after the host reboots the container will always start unless we explicitly stop it.
- map the /config directory inside the container with the /path-to/radarr directory in the host system,that way if the container is removed data persists in the host.
- map the /downloads internal dir to the path where our download client stores its downloads.In this case the path is remote and defined already in fstab.
- map the /movies internal dir to the path where our movies are,in this case remote path defined in fstab.
- environment variable with our timezone.
- environment variable with the docker user’s id and group id.
- map the internal port of the container to an available port on the host.
- use the latest image of radarr repo uploaded to docker hub by user linuxserver to create the container,no tag for previous versions defined.
The web interface of Radarr can be accessed on ip:7878.
docker run -d \ --name=sonarr \ --restart=unless-stopped \ -p 8989:8989 \ -e PGID=150 -e PUID=1000 \ -e TZ='Europe/Athens' \ -v /home/dockeras/sonarr:/config \ -v /mnt/downloads:/downloads \ -v /mnt/downloads:/tv \ linuxserver/sonarr
8,9. The Sonarr container needs to know specifically where is the host directory for the downloaded files so they can be moved to the tv directory. In this example the remote folder for tv episodes is in the same HDD volume with the downloads so the same path needs to be mapped twice in the config.
The web interface of Sonarr can be accessed on ip:8989.
docker run -d \ --restart=unless-stopped \ --name=jackett \ -v /home/dockeras/jackett:/config \ -e PGID=150 -e PUID=1000 \ -e TZ='Europe/Athens' \ -p 9117:9117 \ linuxserver/jackett
The web interface of Jackett is ip:9117.
How to update the containers
Check the names of active and inactive containers:
docker ps -a
Stop the container we want updated by name and remove it:
docker stop sonarr
docker rm sonarr
Run the container again based on previous steps.
Optionally delete older image to free up space:
docker rmi 3395
Essential web interface setup
Most common settings in web interface that needs attention:
In case our download folder is in a different machine we need to add remote path mappings in sonarr/radarr download client settings:
This part confuses many people.The Remote Path in the options is actually the Remote local Path of the Downloads folder.
The best way to find the actual path is to check a downloaded file’s path or properties from the local machine, for example ssh to the remote linux/NAS. A common mistake many people do is to confuse a mount to a remote machine, with a local path.
The Local Path in the options is actually the Local remote Path, and refers to the mapping in the docker host of the remote local path.Best way to find the host’s actual local path to the remote machine is to enter e.g in our example the /mnt/downloads dir and type pwd when we reach the Downloads folder.
In this How-to we examined the installation of dockerized versions of the most popular apps for home theater automation. We explain mounting smb shares in a way to persist Alpine reboot, introduce key concepts of the docker tech, installed the three containers and lastly explained the two common issues one might come across when configuring the apps from their web interface.
There will be another turorial on how to automate running and updating our containers in bulk with the help of Docker Compose.