docker-compose.yaml examples

##########
# System #
##########
version: "3.6"
services:
############
# Test/Dev #
############
##############
# ZoneMinder #
##############
  zoneminder:
    image: linuxserver/zoneminder
    container_name: zoneminder
    hostname: zoneminder
    restart: always
    depends_on:
      - mariadb
    shm_size: 4096M
    ports:
      - "8083:80"
    volumes:
      - ${USERDIR}/docker/zoneminder/config:/config
      - ${USERDIR}/docker/zoneminder/database:/data/database
      - /mnt/nas/media/CCTV/events:/data/zoneminder/events
      - /etc/localtime:/etc/localtime:ro
    environment:
      - TZ=Europe/London
      - PHP_TZ=Europe/London
      - PUID=${PUID}
      - PGID=${PGID}
##################
#  HomeAssistant #
##################
  homeassistant:
    image: homeassistant/home-assistant
    container_name: homeassistant
    hostname: hass
    restart: always
    depends_on:
      - mosquitto
      - influxdb
      - grafana
      - appdaemon
#      - nodered
#      - tasmoadmin
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0
      - /dev/ttyUSB1:/dev/ttyUSB1
      - /dev/ttyACM0:/dev/ttyACM0
    volumes:
      - ${USERDIR}/docker/homeassistant:/config
      - /etc/localtime:/etc/localtime:ro
      - ${USERDIR}/docker/shared:/shared
    ports:
      - "8123:8123"
    privileged: true
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
############
# MQTT #
############
  mosquitto:
    image: eclipse-mosquitto
    container_name: mosquitto
    restart: always
    ports:
      - "1883:1883/tcp"
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /etc/ssl:/etc/ssl:ro
      - /etc/ca-certificates:/usr/share/ca-certificates:ro
      - ${USERDIR}/docker/mosquitto-config:/mosquitto/config
      - ${USERDIR}/docker/mosquitto-data:/mosquitto/data

##############
# TasmoAdmin #
##############
#  tasmoamdin:
#    image_name:
#    container_name: tasmoadmin
#    restart: always

###########
# NodeRED #
###########
#  nodered:
#    image_name:
#    container_name: nodered
#    restart: always

############
# InfluxDB #
############
  influxdb:
    image: influxdb:latest
    container_name: influxdb
    restart: always
    volumes:
      - ${USERDIR}/docker/influxdb:/var/lib/influxdb

###########
# Grafana #
###########
  grafana:
    image: grafana/grafana:latest
    container_name: grafana
    restart: always
    depends_on:
      - influxdb
    volumes:
      - ${USERDIR}/docker/grafana:/var/lib/grafana
      - /etc/localtime:/etc/localtime:ro
    ports:
      - 3001:3000/tcp

#############
# AppDaemon #
#############
  appdaemon:
    image: acockburn/appdaemon:latest
    container_name: appdaemon
    restart: always
    ports:
      - 5050:5050
    volumes:
      - ${USERDIR}/docker/appdaemon:/conf

###############
# LetsEncrypt #
###############
#  letsencrypt:
#    image_name:
#    container_name: letsencrypt
#    restart: always

#########
# NGINX #
#########
#  nginx:
#    image: nginx:latest
#    container_name: nginx
#    restart: always
#    volumes:
#      - ${USERDIR}/docker/nginx/nginx.conf:/etc/nginx/nginx.conf
#    ports:
#      - 80:80
#      - 443:443

##########
# Active #
##########
###########
# mariadb #
###########
  mariadb:
    image: linuxserver/mariadb:latest
    container_name: mariadb
    hostname: mariadb
    restart: always
    network_mode: host
    volumes:
        - ${USERDIR}/docker/mariadb:/config
    ports:
      - "3306:3306"
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
#############
# Portainer #
#############
  portainer:
    image: portainer/portainer:latest
    container_name: portainer
    hostname: 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}
##############
# watchtower #
##############
  watchtower:
    image: v2tec/watchtower
    container_name: watchtower
    hostname: watchtower
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    command: --schedule "0 0 23 * * SUN" --cleanup
############
# Organizr #
############
  organizr:
    image: lsiocommunity/organizr
    container_name: organizr
    hostname: organizr
    restart: always
    volumes:
      - ${USERDIR}/docker/organizr:/config
      - ${USERDIR}/docker/shared:/shared
    ports:
      - "80:80"
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
##############
# phpmyadmin #
##############
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: phpmyadmin
    hostname: phpmyadmin:latest
    restart: always
    links:
      - mariadb:db
    ports:
      - 82:82
    environment:
      - PMA_HOST=mariadb
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
########################
# Tranmission with VPN #
########################
  transmission-vpn:
    image: haugene/transmission-openvpn
    container_name: transmission-vpn
    restart: always
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun
    ports:
    - "9091:9091"
    dns:
      - 8.8.8.8
      - 8.8.4.4
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ${USERDIR}/docker/transmission-vpn:/data
      - ${USERDIR}/docker/shared:/shared
      - /mnt/nas/temp/torrents/watch:/data/watch
      - /mnt/nas/temp/torrents/completed:/data/completed
      - /mnt/nas/temp/torrents/incomplete:/data/incomplete
    environment:
      - OPENVPN_PROVIDER=NORDVPN
      - OPENVPN_USERNAME=YourUsername
      - OPENVPN_PASSWORD=YourPassword
      - OPENVPN_OPTS=--inactive 3600 --ping 10 --ping-exit 60
      - NORDVPN_COUNTRY=uk
      - OPENVPN_CONFIG=uk737.nordvpn.com.udp
      - CREATE_TUN_DEVICE=true
      - LOCAL_NETWORK=172.16.1.0/24,172.16.2.0/24
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
      - TRANSMISSION_RPC_AUTHENTICATION_REQUIRED=false
      - TRANSMISSION_RPC_HOST_WHITELIST=127.0.0.1,172.16.1.*,172.16.2.*
      - TRANSMISSION_RPC_PASSWORD=YourPassword
      - TRANSMISSION_RPC_USERNAME=YourUsername
      - TRANSMISSION_UMASK=002
      - TRANSMISSION_RATIO_LIMIT=1.00
      - TRANSMISSION_RATIO_LIMIT_ENABLED=true
      - TRANSMISSION_WATCH_DIR=/data/watch
      - TRANSMISSION_WATCH_DIR_ENABLED=true
      - TRANSMISSION_INCOMPLETE_DIR=/data/incomplete
      - TRANSMISSION_INCOMPLETE_DIR_ENABLED=true
      - TRANSMISSION_DOWNLOAD_DIR=/data/completed
      - TRANSMISSION_SPEED_LIMIT_UP=25
      - TRANSMISSION_SPEED_LIMIT_UP_ENABLED=true
      - TRANSMISSION_TRASH_ORIGINAL_TORRENT_FILES=true
      - TRANSMISSION_START_ADDED_TORRENTS=true
###############
# couchpotato #
###############
  couchpotato:
    image: linuxserver/couchpotato:latest
    container_name: couchpotato
    hostname: couchpotato
    restart: always
    volumes:
      - ${USERDIR}/docker/couchpotato:/config
      - ${USERDIR}/Downloads/completed:/downloads
      - ${USERDIR}/media/movies:/movies
      - /mnt/nas/media:/mnt/nas/media
      - /mnt/nas/temp:/mnt/nas/temp
      - ${USERDIR}/docker/shared:/shared
    ports:
      - "8082:5050"
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - UMASK_SET=002
      - TZ=${TZ}
#############
# sickchill #
#############
  sickchill:
    image: linuxserver/sickchill:latest
    container_name: sickchill
    hostname: sickchill
    restart: always
    volumes:
      - ${USERDIR}/docker/sickchill:/config
      - ${USERDIR}/docker/shared:/shared
      - /mnt/nas/media:/mnt/nas/media
      - /mnt/nas/temp:/mnt/nas/temp
    ports:
      - "8081:8081"
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
############
# tautulli #
############
  tautulli:
    image: linuxserver/tautulli
    container_name: tautulli
    hostname: tautulli
    restart: always
    volumes:
      - ${USERDIR}/docker/tautulli/config:/config
      - ${USERDIR}/docker/tautulli/logs:/logs:ro
      - /mnt/nas/media:/mnt/nas/media
      - /mnt/nas/temp:/mnt/nas/temp
      - ${USERDIR}/docker/shared:/shared
    ports:
      - "8181:8181"
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
##########
# PlexMS #
##########
  plexms:
    image: plexinc/pms-docker:plexpass
    container_name: plexms
    hostname: plexms
    network_mode: host
    restart: always
    volumes:
      - ${USERDIR}/docker/plexms:/config
      - ${USERDIR}/Downloads/plex_tmp/transcode:/transcode
      - /mnt/nas/media:/mnt/nas/media
      - /mnt/nas/temp:/mnt/nas/temp
      - /mnt/nas/hidden:/mnt/nas/hidden
      - ${USERDIR}/docker/shared:/shared
    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="PorterPlex"
      - PLEX_CLAIM="claim-xxxxxxxxxxxxxxxxxxxxxxxx"
      - PLEX_UID=${PUID}
      - PLEX_GID=${PGID}
Advertisements

Home Docker Server

As per the norm, I will skip the bumf and jump straight in to the process I used as you should know what you are doing, if not go off learn and come back

  1. Install Ubuntu Server 18.04 LTS:
    1. Download here: https://www.ubuntu.com
  2. If not installed during Setup, Install the following:
    1. OpenSSH Server: Instructions here
    2. Samba: Instructions here
    3. Standard Utilities: sudo apt-get install standard
    4. Udev (required for Plex & LiveTV: sudo apt-get install udev
  3. Install Docker:
    1. sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
    2. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
    3. sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”
    4. sudo apt-get update
    5. sudo apt-get install docker-ce
    6. sudo docker run hello-world
  4. Install Docker Compose:
    1. Check latest version here – https://github.com/docker/compose/releases and change version in next step
    2. sudo curl -L https://github.com/docker/compose/releases/download/1.23.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
    3. sudo chmod +x /usr/local/bin/docker-compose
    4. sudo usermod -aG docker ${USER}
    5. type “id” hit enter and note the uid of your user & gid of docker
    6. type “cd ~ ; pwd” hit enter and note location of user directory
    7. sudo nano /etc/environment
    8. Replace/Configure “PUID” & “PGID” as listed above, “TZ” as listed here, “USERDIR” of the docker user & “MYSQL_ROOT_PASSWORD” for MariaDB and phpMyAdmin
PUID=1000
PGID=999
TZ="Europe/London"
USERDIR="/home/<USERNAME>"
MYSQL_ROOT_PASSWORD="password"
    1. Type “exit” hit enter and log back in
  1. Basic Docker & Docker Composer
    1. mkdir ~/docker
    2. sudo setfacl -Rdm g:docker:rwx ~/docker
    3. sudo chmod -R 775 ~/docker
  2. Create basic Docker Compose File
    1. nano ~/docker/docker-compose.yml
    2. Add the following:
version: "3.6"
services:

Why not check out my docker-compose.yaml here. I highly suggest installing the following:

      • Portainer – Container Management
      • Organizr – Tabbed web interface for all your container
      • NGINX – Reverse proxy
      • Watchtower – Automatic Container updating

You may also want to check out this article here on mounting external storage if you are using Plex, ZoneMinder etc

  1. Starting docker compose
    1. docker-compose -f ~/docker/docker-compose.yml up -d