https://hub.docker.com/r/linuxserver/plex


http://localhost:32400/web

View via localhost

Get claim token via https://plex.tv/claim 


WD=/opt/plex
mkdir -p $WD/{setup,library}
cd $WD/setup
cat << 'EOF' >docker-compose.yaml
version: '3.7'

services:
 plex:
    container_name: plex
    image: linuxserver/plex
    hostname: plex
    network_mode: host

    volumes:
      - type: bind
        source: /opt/plex/library/
        target: /config
      - type: bind
        source: /opt/plex/tvseries/
        target: /tv
      - type: bind
        source: /opt/plex/movies/
        target: /movies

    environment:
      - PUID=1000
      - PGID=1000
      - VERSION=docker
      - PLEX_CLAIM=claim-TCCix5Fyo-fFBDCB5LmR
EOF
chmod +x docker-compose.yaml

WD=/opt/plex/setup
cat << EOF >$WD/plex.service.setup.sh
cat << EOL >/lib/systemd/system/plex.service
[Unit]
Description=plex_Docker
Requires=docker.service network-online.target

[Service]

Restart=on-abnormal
ExecStart=/usr/bin/docker-compose --project-name plex --project-directory $WD -f $WD/docker-compose.yaml up
ExecStop=/usr/bin/docker-compose --project-name plex --project-directory $WD -f $WD/docker-compose.yaml stop

[Install]
WantedBy=multi-user.target
EOL
systemctl enable plex
systemctl restart plex
systemctl status plex
EOF
chmod +x $WD/plex.service.setup.sh
$WD/plex.service.setup.sh