đĨ Watch the Video Tutorial
đĄ Why Self-Hosted Plex?
Plex is a media streaming solution. But instead of uploading your media to someone else’s cloud, Plex runs on your hardware, in your home lab, on your network. You store your legally owned movies and TV shows where you want them. You organize them how you want. You stream them to your devices â locally or remotely â without depending on any cloud service. Combine Plex with Docker and Tailscale, and you’ve got a professional-grade media server that’s portable, secure, and accessible from anywhere without opening a single port on your router. By the end of this guide, you’ll have Plex running in its own isolated Docker stack, connected to your Plex account, with remote access via Tailscale, ready to stream your personal media library anywhere. âšī¸ Note: This guide assumes you have Docker and Docker Compose set up on an Ubuntu VM, following my previous Docker tutorials. It builds on the standard home lab setup. If you haven’t set that up yet, start there first.đ What You’ll Need
- An Ubuntu Docker host (VM on Proxmox or bare metal) with Docker and Docker Compose installed
- Storage for your media (NAS, external drive, or local SSD â at least 100GB+)
- Plex account (free account is fine; Premium adds extras)
- Tailscale account (free tier, for secure remote access)
- Tailscale auth key generated and ready to paste
- SSH access to your Docker host
- Familiarity with terminal commands and Docker Compose
đ Step-by-Step Setup
1. Create Directory Structure
SSH into your Docker host. Create the folder for Plex:mkdir -p /media/docker/scripts/plex/
cd /media/docker/scripts/plex
This standardized location makes it easy to back up, restore, or move to different hardware.
2. Get Your Plex Claim Token
Before you start the container, you need a Plex claim token. This associates the server with your Plex account.- Go to
https://www.plex.tv/claim - Log in with your Plex account (create one if needed)
- Copy the claim token (looks like
claim-XXXXXXXXXXXXX) - Important: This token only lasts 4 minutes, so copy it immediately
3. Download compose.yml and .env Files
The full files are in my GitHub repository.
4. Start the Stack
Navigate to your plex folder and deploy:cd /media/docker/scripts/plex
docker compose --env-file .env --env-file .env.secrets up -d
Docker pulls the images, creates the network, and starts both containers.
5. Verify Containers Are Running
docker ps
You should see both plex and plex-tailscale running.
6. Get Your Tailscale URL
Go to your Tailscale admin panel athttps://login.tailscale.com/admin/machines
Find your ‘plex’ machine and get its Tailscale URL. It looks like:
https://plex.tail[your-domain].ts.net
7. Claim Plex to Your Account
Open your Plex Tailscale URL in a browser:https://plex.tail[your-domain].ts.net/web
The setup page should appear. It will recognize your claim token and ask you to complete setup.
Log in with your Plex account credentials if prompted.
Click through the setup wizard:
- Name your Plex server (e.g., “Living Room” or “Home Media”)
- Choose whether to add media libraries now (you can do this later)
- Complete setup
8. Add Media Libraries
In the Plex dashboard, click to add a library. Select library type: Movies, TV Shows, Music, or Photos. When asked to browse for the media folder, navigate to your MEDIA_PATH. For example, if you set MEDIA_PATH=/media/mynas/PlexData, browse to that location and select subfolder (movies, shows, etc.). Repeat for each library type you want to add. Plex will automatically scan these folders and add new content as you add files.9. Cleanup (Optional)
Now that Plex is claimed, you don’t need the claim token anymore. Comment it out in .env.secrets:#PLEX_CLAIM=claim-XXXXXXXXXXXX
Restart the stack:
docker compose down
docker compose up -d
đ Media Organization
Structure your media folder like this:/media/mynas/PlexData/
âââ Movies/
â âââ Movie Name (Year)/
â â âââ Movie.mkv
â âââ Another Movie (Year)/
â âââ Another.Movie.mkv
âââ Shows/
â âââ Show Name/
â â âââ Season 01/
â â â âââ S01E01.mkv
â â â âââ S01E02.mkv
â â âââ Season 02/
â â âââ S02E01.mkv
â âââ Another Show/
âââ Music/
âââ Artist/Album/track.mp3
Plex is smart about naming. As long as your files follow standard naming conventions, it will detect and organize them automatically.
đ Accessing Your Plex Server
On your local network: Plex auto-discovers local servers. Open the Plex app on any device on your network and it should appear. Remotely via Tailscale: Open your Plex Tailscale URL in any browser from a device connected to Tailscale:https://plex.tail[your-domain].ts.net
Mobile apps:
Download the Plex app for iOS or Android. It will auto-discover your server on the local network. For remote access, make sure you’re connected to Tailscale on your phone.
âī¸ Understanding the Setup
PLEX_CLAIM: One-time token to associate the server with your account. Expires after 4 minutes of use, then you don’t need it again. CONFIG_PATH: Where Plex stores its configuration, metadata, and database. Keeps everything portable. MEDIA_PATH: Where your actual media files live. Can be on a NAS, external drive, or local storage. Transcode folder: Plex uses this to temporarily store transcoded video when devices request different quality levels. Watchtower: Automatically updates Plex to the latest version. Tailscale: Secure remote access without exposing ports or using VPN tunnels. Your Plex server is only accessible to devices on your Tailscale network.â ī¸ Important Considerations
Transcode performance: Plex transcoding uses CPU. If you have limited CPU cores, transcoding can be slow. More cores = faster transcoding. Media storage: Use reliable storage (NAS, external drive with redundancy, or cloud backup). If your media is lost, re-ripping everything is time-consuming. Bandwidth: Streaming remotely uses your internet bandwidth. High quality (4K, 10Mbps+) requires good upload speeds from your home. Plex Pass: The free Plex tier is fully functional. Premium features (offline sync, early access to features) require Plex Pass subscription, but it’s optional. Legal considerations: Only store legally owned content. Rip your own Blu-rays and DVDs, or use content you have licenses for.đ What’s Next?
Now you have a working Plex server. You can:- Add your media library (rip your Blu-rays and DVDs, organize them)
- Set up multiple libraries for different content types
- Share access with family members (invite other Plex users)
- Enable premium features if you upgrade to Plex Pass
- Use the Plex mobile apps to stream from anywhere
- Set up Plex on additional devices in your home
â Conclusion
Plex in Docker gives you a professional-grade media server that’s portable, secure, and private. Your media stays where you control it. You access it over your home network or securely via Tailscale from anywhere. No cloud dependency. No subscription required for basic streaming. The setup is straightforward: create folders, set environment variables, deploy with Docker Compose, claim to your Plex account, and start adding media. Watchtower keeps Plex updated automatically. Tailscale gives you secure remote access. Docker keeps everything isolated and portable. Your media library is now yours â and only yours.đē Watch the full video guide: IT HomeLab Online on YouTube If you found this helpful, like and subscribe to IT HomeLab Online for more tutorials. âī¸ Support the channel: Buy Me a Coffee