# ![Plex Media Server](<https://daemonless.io/images/logos/plex.svg>) Plex Media Server

[![Build Status](<https://img.shields.io/github/actions/workflow/status/daemonless/plex/build.yaml?style=flat-square&amp;label=Build&amp;color=green>)](<https://github.com/daemonless/plex/actions>) [![Last Commit](<https://img.shields.io/github/last-commit/daemonless/plex?style=flat-square&amp;label=Last+Commit&amp;color=blue>)](<https://github.com/daemonless/plex/commits>) [![OCI Pulls](<https://img.shields.io/docker/pulls/daemonless/plex?style=flat-square&amp;label=OCI+Pulls&amp;color=blue>)](<https://hub.docker.com/r/daemonless/plex>)

Personal media server that organizes and streams your movie, TV, and music collections to all your devices.

[[![Plex Media Server screenshot 1](<https://daemonless.io/images/screenshots/plex/screenshot_1.jpg>)](</images/screenshots/plex/screenshot_1.jpg>)](</images/screenshots/plex/screenshot_1.jpg>) [[![Plex Media Server screenshot 2](<https://daemonless.io/images/screenshots/plex/screenshot_2.jpg>)](</images/screenshots/plex/screenshot_2.jpg>)](</images/screenshots/plex/screenshot_2.jpg>) [[![Plex Media Server screenshot 3](<https://daemonless.io/images/screenshots/plex/screenshot_3.jpg>)](</images/screenshots/plex/screenshot_3.jpg>)](</images/screenshots/plex/screenshot_3.jpg>)

|  |  |
| --- | --- |
| **Port** | `32400` |
| **Registry** | [`ghcr.io/daemonless/plex`](<https://github.com/daemonless/plex/pkgs/container/plex>) |
| **Daemonless** | [daemonless/plex](<https://github.com/daemonless/plex>) |
| **Source** | [daemonless/plex](<https://github.com/daemonless/plex>) |
| **Website** | [plex.tv](<https://plex.tv/>) |

## First-time setup

An unclaimed Plex server only accepts its setup wizard from `127.0.0.1`; from anywhere else it answers "Not authorized". Set one of these before the first start:

- `ALLOWED_NETWORKS` to your LAN (e.g. `192.168.1.0/24`), then open `http://<host>:32400/web`, sign in and finish the wizard. Devices on those networks can use Plex without signing in.
- `PLEX_CLAIM` to a token from [https://plex.tv/claim](<https://plex.tv/claim>). The container claims the server on first start; then sign in at `http://<host>:32400/web`. Tokens expire 4 minutes after you get one: fetch it right before the first start.

Set `ADVERTISE_IP` to the address clients should use (e.g. `http://192.168.1.10:32400`), so Plex doesn't advertise its container-internal IP.

`PLEX_CLAIM`, `ADVERTISE_IP` and `ALLOWED_NETWORKS` work as in the official Plex image.

## Host networking (optional)

`network_mode: host` (`--network host`) additionally lets Plex apps on your LAN discover the server (GDM) and enables DLNA. Use it instead of the `32400` port mapping where your platform supports it.

## Prerequisites

Before deploying, ensure your host environment is ready. See the [Quick Start Guide](<https://daemonless.io/guides/quick-start/index.md>) for host setup instructions, including the security model for host vs. container privileges.

## Deployment

**Customize Paths, UID & Ports**

Install and manage **Plex Media Server** on FreeBSD with [fjord](<https://fjord.daemonless.io>):

```
fjord install plex
```

Or open the **App Store** in the fjord web UI and install **Plex Media Server** from the wizard. New to fjord? See the [Install Guide](<https://fjord.daemonless.io/install/>).

```
services:
  plex:
    image: "ghcr.io/daemonless/plex:latest"
    container_name: plex
    environment:
      - PUID=1000  # User ID for the application process
      - PGID=1000  # Group ID for the application process
      - TZ=UTC  # Timezone for the container
      - VERSION=container  # Plex update channel (container, public, plexpass)
      - PLEX_CLAIM=  # Claim token — get one at https://plex.tv/claim
      - ADVERTISE_IP=  # URLs clients should use to reach the server, comma-separated, e.g. http://192.168.1.10:32400 (bridge networking)
      - ALLOWED_NETWORKS=  # Networks allowed in without signing in, comma-separated, e.g. 192.168.1.0/24
    volumes:
      - "/containers/plex:/config"
      - "/containers/plex/transcode:/transcode" # optional
      - "/path/to/movies:/movies"
      - "/path/to/tv:/tv"
    ports:
      - "32400:32400"
    # always (not unless-stopped) so FreeBSD's podman rc.d auto-starts it at boot
    restart: always
```

Save as `compose.yaml`, then run `podman-compose up -d`.

> [!WARNING]
>
> Exposing ports in AppJail means that your service can be reached from remote hosts. If that is not your intention, do not expose the ports and communicate with the service using the jail's IPv4 address or hostname assigned by the virtual network.

```
# .env

DIRECTOR_PROJECT=plex
PUID=1000
PGID=1000
TZ=UTC
VERSION=container
PLEX_CLAIM=
ADVERTISE_IP=
ALLOWED_NETWORKS=
```

```
# appjail-director.yml

options:
  - virtualnet: ':<random> default'
  - nat:
services:
  plex:
    name: plex
    options:
      - container: 'args:--pull'
      - expose: '32400:32400 proto:tcp'
    oci:
      user: root
      environment:
        - PUID: !ENV '${PUID}'
        - PGID: !ENV '${PGID}'
        - TZ: !ENV '${TZ}'
        - VERSION: !ENV '${VERSION}'
        - PLEX_CLAIM: !ENV '${PLEX_CLAIM}'
        - ADVERTISE_IP: !ENV '${ADVERTISE_IP}'
        - ALLOWED_NETWORKS: !ENV '${ALLOWED_NETWORKS}'
    volumes:
      - plex: /config
      - plex_transcode: /transcode
      - movies: /movies
      - tv: /tv
volumes:
  plex:
    device: '/containers/plex'
  plex_transcode:
    device: '/containers/plex/transcode'
  movies:
    device: 'movies'
  tv:
    device: 'tv'
```

```
# Makejail

ARG tag=latest

OPTION container=boot
OPTION overwrite=force
OPTION from=ghcr.io/daemonless/plex:${tag}
```

Save the files above, then run `appjail-director up`.

> [!WARNING]
>
> **Experimental**
>
> Bastille's OCI support is experimental. It requires `buildah` and shares the host network stack (`inherit`). Mount volumes with `--volume HOST JAIL`; without it, image-declared volumes are stored under `${bastille_volumesdir}/${jail}`.

```
services:
  plex:
    name: plex
    image: "ghcr.io/daemonless/plex:latest"
    network:
      - mode: host
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=UTC
      - VERSION=container
      - PLEX_CLAIM=
      - ADVERTISE_IP=
      - ALLOWED_NETWORKS=
    volumes:
      - "/containers/plex:/config"
      - "/containers/plex/transcode:/transcode"
      - "/path/to/movies:/movies"
      - "/path/to/tv:/tv"
```

Save as `bastille-compose.yml`, then run `bastille up`.

Open `http://<server>:32400` from another machine (the server's own browser can't use a published port).

## Parameters

### Environment Variables

| Variable | Default | Description |
| --- | --- | --- |
| `PUID` | `1000` | User ID for the application process |
| `PGID` | `1000` | Group ID for the application process |
| `TZ` | `UTC` | Timezone for the container |
| `VERSION` | `container` | Plex update channel (container, public, plexpass) |
| `PLEX_CLAIM` | \`\` | Claim token — get one at [https://plex.tv/claim](<https://plex.tv/claim>) |
| `ADVERTISE_IP` | \`\` | URLs clients should use to reach the server, comma-separated, e.g. [http://192.168.1.10:32400](<http://192.168.1.10:32400>) (bridge networking) |
| `ALLOWED_NETWORKS` | \`\` | Networks allowed in without signing in, comma-separated, e.g. 192.168.1.0/24 |

### Volumes

| Path | Description |
| --- | --- |
| `/config` | Configuration directory |
| `/transcode` | Transcode directory (Optional) |
| `/movies` | Movie library |
| `/tv` | TV series library |

### Ports

| Port | Protocol | Description |
| --- | --- | --- |
| `32400` | TCP | Web UI |

## Version Tags

| Tag | Description | Best For |
| :--- | :--- | :--- |
| `latest` | **Upstream Binary**. Built from official release. | Most users — recommended. |

> [!NOTE]
>
> **Implementation Details**
>
> - **Architectures:** amd64
> - **User:** `bsd` (UID/GID set via [PUID/PGID](<https://daemonless.io/guides/permissions/index.md>)). Defaults to `1000:1000`.
> - **Base:** Built on `ghcr.io/daemonless/base` (FreeBSD 15).

---

Need help? Join our [Discord](<https://discord.gg/Kb9tkhecZT>) community.
