Home ARCHIVED: Install Plex Media Server on Docker
Post
Cancel
Preview Image

ARCHIVED: Install Plex Media Server on Docker

This install assumes that Docker has been installed previously, and extends the Docker stack created for the Traefik Reverse Proxy.

Plex Media Server gives you one place to find and access all the media that matters to you. From personal media on your own server, to free and on-demand Movies & Shows or live TV, to streaming music, you can enjoy it all in one app, on any device. It supports everything from Movies, TV Shows, Home Videos to Music & Photos.

Install Plex Media Server

Create folders for Plex data:

1
2
3
cd ~/docker
mkdir plex
mkdir plex/transcode

Add the following service definition to dc-plex.yml in docker root folder

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
version: "3.9"

# NETWORKS ####################################################

networks:
  traefik_proxy:
    external: true

# VOLUMES #####################################################

volumes:
  cifs_media_mount:     # SMB share to //TITAN/media folder
    driver: local
    driver_opts:
      type: cifs    
      device: //$TRUENAS_SERVER_IP/media
      o: "username=$PLEX_USER,password=$PLEX_PASSWORD,vers=3.0,uid=$PUID,gid=$PGID"

# SERVICES ####################################################

services:

  plex:
    container_name: plex
    image: plexinc/pms-docker
    #
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    #
    networks:
      - traefik_proxy
    # devices:
    #   - /dev/dri:/dev/dri # for harware transcoding
    ports:
      - 32400:32400/tcp
      - 3005:3005/tcp
      # - 8324:8324/tcp    # Plex for Roku
      # - 32469:32469/tcp  # Plex DLNA server
      # - 1900:1900/udp    # Plex DLNA server
      - 32410:32410/udp
      - 32412:32412/udp
      - 32413:32413/udp
      - 32414:32414/udp
    volumes:
      - $DOCKERDIR/plex:/config
      - $DOCKERDIR/plex/transcode:/transcode
      - cifs_media_mount:/data # Refer to VOLUMES section above
    environment:
      HOSTNAME: PlexMediaServer
      # PLEX_CLAIM_FILE: $PLEX_CLAIM
      TZ: $TZ
      PLEX_UID: $PUID
      PLEX_GID: $PGID
      ADVERTISE_IP: "https://plex.$DOMAINNAME_CLOUD_SERVER"
    labels:
      - "traefik.enable=true"
      ## HTTP Routers
      - "traefik.http.routers.plex-secure.entrypoints=https"
      - "traefik.http.routers.plex-secure.rule=Host(`plex.$DOMAINNAME_CLOUD_SERVER`)"
      ## Middlewares
      # - "traefik.http.routers.plexms-secure.middlewares=chain-no-auth@file"
      ## HTTP Servicesnoauth
      - "traefik.http.routers.plex-secure.service=plex"
      - "traefik.http.services.plex.loadbalancer.server.port=32400"

From the Docker root folder, run this command to build the container:

1
sudo docker compose -f dc-plex.yml up -d

If you look at the logs, ignore the Critical: libusb_init failed message, associated with not finding the not-installed USB library, apparently associated with DVR functionality

CIFS_MOUNT

  • The media files for Plex are stored on the TrueNAS volumes on server TITAN and need to be accessed over an SMB share. This is achieved through the cifs_mount volume in the Docker compose file above
  • NOTE: Once a volume is created for the container it cannot be changed, even if the container is rebuilt. If the cifs_mount settings change, it is necessary to delete the container then the image, then re-run the docker compose command

Configure Plex Media Server

  • Plex does not offer to setup Media files initially if connected to by a remote server, i.e. Docker. This page describes how to access as “local” via SSH

Resources

This post is licensed under CC BY 4.0 by the author.
Recently Updated
Trending Tags
Contents
Trending Tags