# Running Plex Media Server in Docker on Ubuntu Server

## What is Plex?

Plex brings together all the media that matters to you. Your personal collection will look beautiful alongside stellar streaming content. Enjoy Live TV & DVR, a growing catalog of great web shows, news, and podcasts. It's finally possible to enjoy all the media you love in a single app, on any device, no matter where you are. -https://www.plex.tv/

## Installing Docker

1. Log into the Linux host and run the following commands in a terminal window
   # update software respositories
   sudo apt update
   # install available software updates
   sudo apt upgrade -y
   # install prerequisites
   sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y
   # add docker gpg key
   curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
   # add docker apt repository
   sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
   # install docker
   sudo apt install docker-ce docker-compose containerd.io -y
   # add the current user to the docker group
   sudo usermod -aG docker $USER
   # reauthenticate for the new group membership to take effect
   su - $USER

## Running Plex Media Server Container

1. Continue with the following commands in a terminal window
   # create working directories
   mkdir ~/docker/plex/data -p && mkdir ~/docker/plex/transcode -p && mkdir ~/docker/plex/media -p
   # set owner of working directories
   sudo chown "$USER":"$USER" ~/docker -R
   # run the plex media center docker container
   docker run -d --name plex --network=host -e TZ="America/New_York" -v ~/docker/plex/data:/config -v ~/docker/plex/transcode:/transcode -v ~/docker/plex/media:/data --restart=unless-stopped plexinc/pms-docker
2. Open a web browser and navigate to http://DNSorIP:32400/web
3. Log in with one of the available options or click sign up with email
4. Give the Plex server a name > Click Next
5. Click the Add Library button > Select the media type
6. Select Add folders from the left navigation > Click Browse for media folder > Select the folder to add to the media > Click Add Library
7. Click Next
8. Click Done to complete the server setup
9. Welcome to Plex Media Server

Source: https://hub.docker.com/r/plexinc/pms-docker