First make sure Docker is installed.
https://docs.docker.com/engine/installation/linux/docker-ce/debian/
It’s also useful to add the current user to Docker group to avoid having to use sudo in front of every Docker command.
sudo usermod -aG docker $USER
Now reboot for changes to take affect.
Once you’re up and running again SSH
back in and we simply need to run the Docker parameters to get it up and running. It’s sometimes handy to put them in a wee script for future reference.
Check out the config here; https://hub.docker.com/r/lsioarmhf/sonarr/
I like to keep my config files in /opt
in the host (OSMC) but it’s really up to you, (avoiding critical system folders obviously)
To do this I need to create and change permissions on the folders.
sudo mkdir /opt/sonarr
sudo chown -R $USER:USER /opt/sonarr
We’ll also need the PUID and GUID of the user running Docker.
id $USER
uid=1000(osmc) gid=1000(osmc) groups=1000(osmc),4(adm),6(disk),7(lp),20(dialout),24(cdrom),29(audio),44(video),999(docker)
So it’s 1000
for both here
Now for the script, this can go anywhere that’s handy to run so /home/osmc
works pretty well
sudo vim start_sonarr_docker.sh
#!/bin/bash
docker run -d \
--restart=unless-stopped \
--name sonarr \
-p 8989:8989 \
-e PUID=1000 \
-e PGID=1000 \
-v /opt/sonarr:/config \
-v /mnt/TV:/tv \
-v /mnt/Downloads/tv:/downloads \
lsioarmhf/sonarr
Save & exit
This isn’t a tricky as it looks. The basic rule of thumb is;
The parameters are split into two halves, separated by a colon, the left hand side representing the host and the right the container side. So really it’s up to you. I have a HDD mounted at /mnt
hence my choice on the left of the colon.
Now make the file executable chmod +x start_sonarr_docker.sh
Run it with the dot slash command
./start_sonarr_docker.sh
Just open a browser on any device in your network, type in the IP address of OSMC with port 8989
e.g. 192.168.1.100:8989
To keep Docker containers up to date I like to use watchtower
Google it and you’ll see. It basically keeps things up to date automatically. So again I create a file and make it executable as above;
vim start_watchtower_docker.sh
#!/bin/bash
docker run -d \
--restart=unless-stopped \
--name watchtower \
-v /var/run/docker.sock:/var/run/docker.sock \
armhfbuild/watchtower
Save & exit and chmod +x start_watchtower_docker.sh
SImply run docker ps
to see all running containers and docker ps -a
to see all containers stopped and started.
docker stop <container name>
docker start <container name>
docker restart <container name>
docker rm <container name>
All do exactly as you’d expect with rm
meaning remove.