Docker and You

suineg

<Charitable Administrator>
26,571
16d 5h 42m
Reactions
19,930 1,993 0 0
#1
So I swapped all of my home server applications to docker a little while back and am finally going to write up what I did for those interested in it. It is super easy to work with and so easy to manage long term.

1.) What is docker
2.) File structure
3.) Necessary tools
4.) Config files

Docker

So I am going to give you the basics of what docker is as I understand and use it. There are better sites out there you could get a deeper level of information from if you want to but for the purposes of this thread you will understand the basics of it.

So docker is a framework that allows you to take an application or group of them and expose their data and traffic to the OS but only at a basic level. Think of it like a virtual machine without all the overhead. Everything is contained in the ... container of the docker and docker itself talks to the OS and then back to the container passing just what each side needs. It keeps things really clean when it comes to dependencies that might not be compatible. You remember when you used to have different autoexec.bat files for gaming? It is sort of like that.

There is a little bit of hands off what is in the container and some level of trust with the developer just like any other application. That being said you could build your own so you know exactly what is inside it. I do not but I use trusted containers from known places.


File structure

So I run linux as my server but the beauty of this is you can do this on windows or mac osx as well. You need a place for all of the containers to expose their config files to so you can edit them. You also need to choose how you expose your file structure over to the containers. One of the benefits is you can expose only certain folders and also map new folder names to the container.

I have all of my config files in /opt/docker/ and then a folder for each container. I have all of my exposed files in /library/ and it's mostly media so folders like /library/movies /library/tv etc etc


Necessary Tools

Personally I only use docker compose and docker but there are a ton of tools for automation and web interfaces. Instead of using nginx or some other webserver in a docker that is something I run as part of the OS. If you are not running linux then it would be quite useful to run the webserver in docker for ease of use.

Get Docker CE for Ubuntu
Install Docker for Windows
Get started with Docker for Mac

Those are the official install instructions from docker and it's pretty easy to get running. Once you get that up and running that is all you actually need. For Docker Compose you only need to do something to install it on linux because it's default installed for windows/mac osx.

Install Docker Compose

Compose is super awesome because it allows you to create a yml file that lists all your dockers and what they have access to and you can bring them all down and up within seconds. This allows me to spin up an entirely new server in about 5 minutes max. Copy the docker compose file, download the backup of the containers config folders, install docker, install compose, tell it to run the compose file, and done.

Here is my compose file.

YAML:
--- 
version: '2'
services:
 plex:
  image: linuxserver/plex:latest
  container_name: plex
  volumes:
    - /opt/plex:/config
    - /library:/data
  network_mode: host
  restart: always
  environment:
    - CLAIM="PJVO7UTP3YPJVCQJUYPJ"
    - VERSION=latest
    - PUID=1000
    - PGID=1000
    - TZ=America\New_York
 
 emby:
  image: emby/embyserver:latest
  container_name: emby
  volumes:
    - /opt/emby:/config
    - /library:/data
  ports:
    - 8000:8096
  restart: always
  environment:
    - APP_UID=1000
    - APP_GID=1000
    - TZ=America\New_York

 tautulli:
  image: shiggins8/tautulli
  container_name: tautulli
  depends_on:
    - plex
  volumes:
    - /opt/plexpy:/config
    - /opt/plexpy/logs:/logs:ro
  ports:
    - 8181:8181
  links:
    - plex
  restart: always
  environment:
    - PUID=1000
    - PGID=1000
 
 sonarr:
  image: linuxserver/sonarr
  container_name: sonarr
  volumes:
    - /opt/sonarr:/config
    - /library/tv:/tv
    - /home/suineg/Downloads:/downloads
  ports:
    - 8989:8989
  links:
    - jackett
  restart: always
  environment:
    - PUID=1000
    - PGID=1000
    
 radarr:
  image: linuxserver/radarr
  container_name: radarr
  volumes:
    - /opt/radarr:/config
    - /library/movies:/movies
    - /home/suineg/Downloads:/downloads
  ports:
    - 7878:7878
  links:
    - jackett
  environment:
    - PUID=1000
    - PGID=1000
  restart: always

 jackett:
  image: linuxserver/jackett
  container_name: jackett
  volumes:
    - /opt/jackett/config:/config
    - /opt/jackett/downloads:/downloads
  ports:
    - 9117:9117
  environment:
    - PUID=1000
    - PGID=1000
    - TZ=America\New_York
  restart: always

 calibre:
  image: linuxserver/calibre-web
  container_name: calibre
  ports:
    - 8083:8083
  volumes:
    - /opt/calibre/config:/config
    - /library/books:/books
  environment:
    - PUID=1000
    - PGID=1000
    - TZ=America\New_York
  restart: always

 ombi:
  image: linuxserver/ombi
  container_name: ombi
  ports: 
    - 3579:3579
  volumes:
    - /opt/ombi:/config
    - /etc/localtime:/etc/localtime:ro
  environment:
    - PUID=1000
    - PGID=1000
    - TZ=America\New_York
  restart: always

 influxdb:
  image: influxdb:latest
  container_name: influxdb
  ports:
    - 8085:8083
    - 8086:8086
    - 8090:8090
  volumes:
    - /opt/influxdb:/var/lib/influxdb
  env_file:
    - env.influx
  restart: always

 telegraf:
  image: telegraf:latest
  container_name: telegraf
  links:
    - influxdb
  volumes:
    - /opt/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
    - /var/run/docker.sock:/var/run/docker.sock:ro
  environment:
    - PUID=1000
    - PGID=1000
    - TZ=America\New_York
  restart: always

 grafana:
  image: grafana/grafana:latest
  container_name: grafana
  ports:
    - 3000:3000
  links:
    - influxdb
  env_file: 
    - env.grafana
  restart: always

 rutorrent:
  image: linuxserver/rutorrent
  container_name: rutorrent
  ports:
    - 8087:80
    - 5000:5000
    - 51413:51413
    - 6881:6881
  volumes:
    - /opt/rutorrent:/config
    - /home/suineg/Downloads:/downloads
  environment: 
    - PUID=1000 
    - PGID=1000 
    - TZ=America\New_York
  restart: always

 gazee:
  image: hubcapps/docker-gazee
  container_name: gazee
  ports:
    - 4242:4242
  volumes:
    - /library/comics:/comics
    - /opt/gazee:/config
  environment:
    - PUID=1000
    - PGID=1000
    - TZ=America\New_York
  restart: always
 

suineg

<Charitable Administrator>
26,571
16d 5h 42m
Reactions
19,930 1,993 0 0
#2
Denamian Denamian Void Void jeydax jeydax

As promised, ask questions if you have them. I will add some more info the post later just getting something up and running for now .
 

ZyyzYzzy

Registered Amod
<Moderation Tools>
17,428
23d 23h 27m
Reactions
21,220 1,342 0 0
#3
And here I thought docker was a noun to describe an individual who partakes in docking.
 

Denamian

Night Janitor
<Moderation Tools>
1,742
15d 14h 8m
Reactions
1,407 80 0 0
#5
Cool. I will look in to this when I have the time, probably in the middle of next week. All I'm doing right now is running a plex server and I just plan on adding a couple pluigins (plex requests and Tautili). I have no idea at this time if I'm going to run anything else on it.
 

Void

We're America, bitch!
<Donor All-Stars>
5,955
10d 1h 16m
Reactions
1,610 239 0 0
#6
Hopefully I get some time and reasons to check this out soon. My server has basically turned into nothing but a Plex server just like Denamian's. The people that use mine are mostly too retarded to use something like Plex Requests even (although I've never actually used it myself either). If they want something they just text me, that's about the extent of my automation.

Oh, and I never sent it off to a data center either, I got permission to set it up at work and use our internet there. It is nowhere near as fast as what I'd get at a data center, but it is free, and most everyone I share with only uses it at night anyway so it doesn't conflict with work. And honestly no one here even understands what it does, I told them it was a Minecraft server. I still use a Whatbox for my torrents because it is just so easy and cheap-ish.