Creating Docker-Compose file!(Part 3)

So far we have installed an operating system and did a ton of other stuff but we haven't gotten to any of the actual Media-Server guides. So in this guide I will be giving you a docker compose file that will only need a few tweaks to it and I will let you know what you need to change. I will put # before lines that need to be changed with what to change them with.

There will be no numbering as its one long file. You will however need to open your terminal and type
sudo nano /home/USERNAME/docker/docker-compose.yml

Now you have initiated starting a file called docker-compose.yml inside of the docker folder you created earlier. I strongly suggest getting a good text editor or using Kate on kubuntu and copy and pasting this:

version: "3"
services:
  plexms:
    container_name: plexms
    restart: always
    network_mode: host
    image: plexinc/pms-docker
    volumes:
      - ${USERDIR}/docker/plexms:/config
      - ${USERDIR}/Downloads/plex_tmp:/transcode
      #Where all your media is stored
      - /media/USER:/media
      - ${USERDIR}/docker/shared:/shared
      - ${USERDIR}/docker/letsencryptcerts:/certs:ro
    ports:
      - "32400:32400/tcp"
      - "3005:3005/tcp"
      - "8324:8324/tcp"
      - "32469:32469/tcp"
      - "1900:1900/udp"
      - "32410:32410/udp"
      - "32412:32412/udp"
      - "32413:32413/udp"
      - "32414:32414/udp"
    environment:
      - TZ=${TZ}
      - HOSTNAME="Docker Plex"
      #You get this From Plex
      - PLEX_CLAIM="claim-##########################"
      - PLEX_UID=${PUID}
      - PLEX_GID=${PGID}
      #- ADVERTISE_IP="http://192.168.0.0:32400/"

  portainer:
    image: portainer/portainer
    hostname: portainer
    container_name: portainer
    restart: always
    command: -H unix:///var/run/docker.sock
    ports:
      - "9000:9000"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ${USERDIR}/docker/portainer/data:/data
      - ${USERDIR}/docker/shared:/shared
    environment:
      - TZ=${TZ}

  organizr:
    container_name: organizr
    hostname: organizr
    restart: always
    image: organizrtools/organizr-v2
    volumes:
      - ${USERDIR}/docker/organizr/www:/config/www
      - ${USERDIR}/docker/organizr/organizrlog:/config/log
      - ${USERDIR}/docker/shared:/shared
      - ${USERDIR}/docker/organizr/organizrconfig:/config
    ports:
      - "9983:80"
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}

#Keeps containers up to date
  watchtower:
    container_name: watchtower
    hostname: watchtower
    restart: always
    image: v2tec/watchtower
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    command: --schedule "0 0 4 * * *" --cleanup

#For this make sure to download an .ovpn file from VPN provider and put in openvpn folder inside /home/user/docker/qbittorrent/openvpn, possibility of using a credentials.conf
#Make sure to create categories so sonarr, radarr, lidarr and lazylibrarian can all use them. Set download locations for each category such as Movies category would be /downloads/movies
  qbvpn:
    image: markusmcnugen/qbittorrentvpn
    container_name: qbvpn
    privileged: true
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
      - VPN_ENABLED=yes
      - LAN_NETWORK=192.168.0.0/24
      - NAME_SERVERS=1.1.1.1,1.0.0.1
      - VPN_USERNAME=
      - VPN_PASSWORD=
    volumes:
      - ${USERDIR}/docker/qbittorrent:/config
      #These are all the locations where categories get set in the UI of qBittorrent at ip:8080 username admin password passwordpassword 
      - /media/USER/HDD:/downloads
      - /media/USER/HDD/shows:/downloads/shows
      - /media/USER/HDD/movies:/downloads/movies
      - /media/USER/HDD/books:/downloads/books
      - /media/USER/HDD/audiobooks:/downloads/audiobooks
      - /media/USER/HDD/music:/downloads/music
      - /media/USER/HDD/blackhole:/downloads/torrents
      - /media/USER/HDD/torrents:/downloads/blackhole
      - ${USERDIR}/docker/shared:/shared
    ports:
      - 8080:8080
      - 8999:8999
      - 8999:8999/udp
    restart: unless-stopped

  radarr:
    image: "linuxserver/radarr"
    hostname: radarr
    container_name: "radarr"
    volumes:
      - ${USERDIR}/docker/radarr:/config
      #External Mount for current drive im using(The torrent downloader plays friendly when theyre the same directories inside each container)
      #Remember this can be changed to ${USERDIR}/docker/downloads/movies:/downloads/movies
      - /media/USER/HDD/movies:/downloads/movies
      - ${USERDIR}/media/movies:/movies
      - ${USERDIR}/docker/shared:/shared
      #External Mount so radarr can find archived movies
      #- /media/USER/HDD2:/media/HDD2
    ports:
      - "7878:7878"
    restart: always
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}

  sonarr:
    image: "linuxserver/sonarr"
    hostname: sonarr
    container_name: "sonarr"
    volumes:
      - ${USERDIR}/docker/sonarr:/config
      #External Mount for current drive im using(The torrent downloader plays friendly when theyre the same directories inside each container)
      #Remember this can be changed to ${USERDIR}/docker/downloads/shows:/downloads/shows
      - /media/USER/HDD/shows:/downloads/shows
      - ${USERDIR}/media/media/tvshows:/tv
      - ${USERDIR}/docker/shared:/shared
      #External Mount
      - /media/USER/HDD2:/media/HDD2
    ports:
        - "8989:8989"
    restart: always
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}

  lidarr:
    image: "linuxserver/lidarr"
    hostname: lidarr
    container_name: "lidarr"
    volumes:
      - ${USERDIR}/docker/lidarr:/config
      #(The torrent downloader plays friendly when theyre the same directories inside each container)
      #External Mounts for where the torrent downloaders download the music too and the default directory of where the qbvpn is set for default download directory(Used with Jackett Blackhole and other Torrent Links)
      #Remember this can be changed to ${USERDIR}/docker/downloads/music:/downloads/music and ${USERDIR}/docker/downloads/torrents:/downloads/torrents
      - /media/USER/HDD/music:/downloads/music
      - /media/USER/HDD/torrents:/downloads/torrents
      - ${USERDIR}/media/media/music:/music
      - ${USERDIR}/docker/shared:/shared
      #External Mount
      - /media/USER/HDD2:/media/HDD2

    ports:
      - "8686:8686"
    restart: always
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}

  lazylibrarian:
    image: linuxserver/lazylibrarian
    container_name: lazylibrarian
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
    volumes:
      - ${USERDIR}/docker/lazylib/config:/config
      #External Mount (The torrent downloader plays friendly when theyre the same directories inside each container)
      #Remember this can be changed to ${USERDIR}/docker/downloads/books:/downloads/books
      #Remember this can be changed to ${USERDIR}/docker/downloads/audiobooks:/downloads/audiobooks
      - /media/USER/HDD/books:/downloads/books
      - /media/USER/HDD/audiobooks:/downloads/audiobooks
      - ${USERDIR}/media/media/books:/books
      - ${USERDIR}/docker/shared:/shared
    ports:
      - 5299:5299
    restart: unless-stopped

  tautulli:
    container_name: tautulli
    hostname: tautulli
    restart: always
    image: linuxserver/tautulli
    volumes:
      - ${USERDIR}/docker/tautulli/config:/config
      - ${USERDIR}/docker/tautulli/logs:/logs:ro
      - ${USERDIR}/docker/shared:/shared
    ports:
      - "8181:8181"
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}

  ombi:
    container_name: ombi
    hostname: ombi
    restart: always
    image: linuxserver/ombi
    volumes:
      - ${USERDIR}/docker/ombi:/config
      - ${USERDIR}/docker/shared:/shared
    ports:
      - "3579:3579"
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}

  jackett:
    image: "linuxserver/jackett"
    hostname: jackett
    container_name: "jackett"
    volumes:
      - ${USERDIR}/docker/jackett:/config
      #External Mount for Blackhole downloads
      #Remember this can be changed to ${USERDIR}/docker/downloads/torrents:/downloads
      - /media/USER/HDD/torrents:/downloads
      - ${USERDIR}/docker/shared:/shared
    ports:
      - "9117:9117"
    restart: always
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
  
#This will allow you to generate certficates and keep a webserver up for reverse proxies, ill go into more detail about it later
  letsencrypt:
    image: linuxserver/letsencrypt
    container_name: letsencrypt
    cap_add:
      - NET_ADMIN
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
      #Website you made on freenom
      - URL=yourwebsite.tk
      #Subdomains you chose to use like www,www.plex,plex,www.sonarr,sonarr etc.
      - SUBDOMAINS=www,portainer,sonarr,radarr,plex
      - VALIDATION=http
      #An email is important so you get notifications about your certs.
      - EMAIL=admin@yourwebsite.tk
      - DHLEVEL=2048 #optional
      - ONLY_SUBDOMAINS=false #optional
      #Extra domains seperated by commas that need to have an SSL as well
      - EXTRA_DOMAINS=otherdomain.tk
    volumes:
      - ${USERDIR}/docker/letsencryptcerts:/config
    ports:
      - 443:443
      - 80:80
    restart: unless-stopped

  ubooquity:
    image: linuxserver/ubooquity
    container_name: ubooquity
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
      - MAXMEM=1024
    volumes:
      - ${USERDIR}/docker/uboo/config:/config
      #Remember this can be changed to ${USERDIR}/docker/downloads/books:/downloads/books
      - /media/USER/HDD/books:/downloads/books
      - ${USERDIR}/docker/uboo/comics:/comics
      - ${USERDIR}/docker/shared:/shared
    ports:
      - 2202:2202
      - 2203:2203
    restart: unless-stopped

  psitransfer:
    container_name: psitransfer
    image: psitrax/psitransfer
    restart: unless-stopped
    ports:
      - 3000:3000
    environment:
      - PSITRANSFER_ADMIN_PASS=
    volumes:
      #External Mount for the PSI transfer files
      #Remember this can be changed to ${USERDIR}/docker/downloads/psifiles:/data
      - /media/USER/HDD/files:/data
      
  mydb:
    image: mariadb
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    restart: always
    container_name: mysqldb
    volumes:
      - db:/var/lib/mysql
    ports:
      - 3306:3306
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - MYSQL_PASSWORD=12345
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=12345
#Links to mysql so you can use MySQL for the Database backend of Nextcloud!
  nextcloud:
    image: nextcloud
    container_name: nextcloud
    volumes:
      - /home/USER/docker/newcloud/config:/var/www/html/config
      - /home/USER/docker/newcloud/html:/var/www/html
      - /home/USER/docker/newcloud/apps:/var/www/html/custom_apps
      #Remember this can be changed to ${USERDIR}/docker/downloads/cloud:/var/www/html/data
      - /media/USER/HDD/cloud:/var/www/html/data
      #External Mounts for External Storages inside NextCloud
      #- /media/USER/HDD/blackhole:/media/downloads
      #- /media/USER/HDD/movies:/media/movies
      #- /media/USER/HDD/shows:/media/shows
      #- /media/USER/HDD/music:/media/music
      #- /media/USER/HDD/books:/media/books
      #- /media/USER/HDD2:/media/HDD2
      #Uses the same DB volume as the mysql container
      - db:/var/lib/mysql
    environment:
      - MYSQL_DATABASE=nextcloud
      - MYSQL_HOST=192.168.x.x
      - MYSQL_USER=12345
      - MYSQL_PASSWORD=12345
    ports:
      - 8010:80
    links:
      - mydb
    restart: unless-stopped


volumes:
  db:

If you notice the environment variables we made earlier get used a lot here, it saves time. All the directories it needs gets created and put inside /home/USERNAME/docker and everything that doesn't need readily access goes to /var/lib/docker/volumes like docker_db for nextcloud/mysql.

In the next section we will be taking this docker-compose file and using it to build our entire server in one go! Part 4 here we come!


Revision #2
Created Tue, Jun 18, 2019 6:17 PM by Forlls_Serious
Updated Tue, Jun 18, 2019 6:48 PM by Forlls_Serious