容器部署
本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →
容器镜像
官方容器镜像:jellyfin/jellyfin 。
此镜像同时发布于 GitHub 容器仓库:ghcr.io/jellyfin/jellyfin。
LinuxServer.io 镜像:linuxserver/jellyfin 。
hotio 镜像:ghcr.io/hotio/jellyfin。
Jellyfin 在 Docker Hub 和 GitHub 容器仓库 上提供多架构官方容器镜像。 这些镜像基于 Debian 系统,并直接从 Jellyfin 源代码构建。
提供多个标签用于追踪不同构建和版本级别。
-
latest始终追踪最新稳定版,包括主版本和次版本更新 -
X(如10)追踪主版本,即最新的 10.Y.Z 版本 -
X.Y(如10.11)追踪次版本,即最新的 10.11.Z 版本 -
X.Y.Z(如10.11.0)追踪特定发行版本 -
X.Y.Z.YYYYMMDD-HHMMSS(如10.11.0.20251020-004604)追踪特定打包构建版本
此外,还有多个第三方提供非官方容器镜像,包括 LinuxServer.io(Dockerfile)项目和 hotio(Dockerfile)。这些镜像基于 Ubuntu 系统,使 用官方 Jellyfin Ubuntu 二进制包构建。
安装指南
若要以特定用户/组身份运行 jellyfin,请替换 uid:gid 值。若要使用默认用户,请完全省略 user 参数。
- Docker
- Docker Compose
- Podman
本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →
Docker 允许您在 Linux、Windows 和 macOS 上运行容器。
如果您希望在 Windows 或 macOS 上使用,请改为原生安装 Jellyfin。Windows macOS
虽然在 Windows 或 macOS 主机上通过 Docker 运行 Jellyfin 是可行的,但这不受官方支持。已知在非 Linux 平台的 Docker 中运行时某些功能会失效,特别是:
- 硬件加速转码
- macOS Docker 环境中的媒体扫描
在非 Linux 平台上通过 Docker 运行 Jellyfin 将无法获得任何技术支持。
使用 Docker 创建并运行 Jellyfin 容器的基本步骤如下。
-
按照 官方安装指南安装 Docker。
-
下载最新的容器镜像。
docker pull jellyfin/jellyfin -
为配置和缓存数据创建持久化存储。
可选择在主机上创建两个目录并使用绑定挂载:
mkdir /path/to/configmkdir /path/to/cache或创建两个持久卷:
docker volume create jellyfin-configdocker volume create jellyfin-cache -
通过以下方式之一创建并运行容器。
Docker 的默认网络模式是桥接模式。如果省略主机模式,则将使用桥接模式。
使用主机网络 (--net=host) 是可选的,但若需使用 DLNA 则是必需的。
使用 Docker 命令行界面:
docker run -d \
--name jellyfin \
--user uid:gid \
-p 8096:8096/tcp \
-p 7359:7359/udp \
--volume /path/to/config:/config \ # Alternatively --volume jellyfin-config:/config
--volume /path/to/cache:/cache \ # Alternatively --volume jellyfin-cache:/cache
--mount type=bind,source=/path/to/media,target=/media \
--restart=unless-stopped \
jellyfin/jellyfin
绑定挂载(Bind Mounts)用于将文件夹从主机操作系统传递到容器操作系统,而卷(volumes)由 Docker 维护,可认为更易于外部程序备份和控制。 对于简单设置,使用绑定挂载而非卷通常被认为更简单。 如果需要,可以绑定挂载多个媒体库:
--mount type=bind,source=/path/to/media1,target=/media1
--mount type=bind,source=/path/to/media2,target=/media2,readonly
...etc
可选绑定挂载自定义的服务器端系统字体目录,以便在带有字幕烧录的转码过程中使用这些字体:
--mount type=bind,source=/path/to/fonts,target=/usr/local/share/fonts/custom,readonly
也可以挂载一个回退字体目录。在这种情 况下,您必须在 Jellyfin 服务器设置面板中将回退字体目录设置为 /fallback_fonts:
--mount type=bind,source=/path/to/fallback/fonts,target=/fallback_fonts,readonly
本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →
如果您希望在 Windows 或 macOS 上使用,请改为原生安装 Jellyfin。Windows macOS
虽然在 Windows 或 macOS 主机上通过 Docker 运行 Jellyfin 是可行的,但这不受官方支持。已知在非 Linux 平台的 Docker 中运行时某些功能会失效,特别是:
- 硬件加速转码
- macOS Docker 环境中的媒体扫描
在非 Linux 平台上通过 Docker 运行 Jellyfin 将无法获得任何技术支持。
创建一个如下所示的 docker-compose.yml 文件。
services:
jellyfin:
image: jellyfin/jellyfin
container_name: jellyfin
# Optional - specify the uid and gid you would like Jellyfin to use instead of root
user: uid:gid
ports:
- 8096:8096/tcp
- 7359:7359/udp
volumes:
- /path/to/config:/config
- /path/to/cache:/cache
- type: bind
source: /path/to/media
target: /media
- type: bind
source: /path/to/media2
target: /media2
read_only: true
# Optional - extra fonts to be used during transcoding with subtitle burn-in
- type: bind
source: /path/to/fonts
target: /usr/local/share/fonts/custom
read_only: true
restart: 'unless-stopped'
# Optional - alternative address used for autodiscovery
environment:
- JELLYFIN_PublishedServerUrl=http://example.com
# Optional - may be necessary for docker healthcheck to pass if running in host network mode
extra_hosts:
- 'host.docker.internal:host-gateway'
然后在 docker-compose.yml 所在目录执行:
docker compose up
若要在后台运行容器,请在上述命令中添加 -d 参数。
您可以通过阅读官方 Docker 文档了解更多 Docker 使用信息。
本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →
Podman 允许您运行非特权容器。
使用 Podman 运行 Jellyfin 的步骤与 Docker 类似。
-
安装 Podman:
sudo dnf install -y podman -
创建并运行 Jellyfin 容器:
podman run \--detach \--label "io.containers.autoupdate=registry" \--name myjellyfin \--publish 8096:8096/tcp \--publish 7359:7359/udp \--rm \--user $(id -u):$(id -g) \--userns keep-id \--volume jellyfin-cache:/cache:Z \--volume jellyfin-config:/config:Z \--mount type=bind,source=/path/to/media,destination=/media,ro=true,relabel=private \docker.io/jellyfin/jellyfin:latest -
若希望允许从主机外部访问 Jellyfin 服务器,请在系统防火墙中开放必要端口。 使用无根 Podman 时此操作不会自动完成。 若您的系统使用
firewalld,以下命令将保存并加载新的防火墙规则,开放用于 TCP 连接的 HTTP 端口8096。此外还需开放 UDP 端口 7359 用于自动发现。sudo firewall-cmd --add-port=8096/tcp --permanentsudo firewall-cmd --add-port=7359/udp --permanentsudo firewall-cmd --reload
Podman 运行容器不需要 root 权限,但需注意某些细节(参见相关文档)。
出于安全考虑,应使用无根 Podman 运行 Jellyfin 容器。
此外,在容器内以非 root 用户身份运行更安全。
--user 选项会在容器内部使用指定的用户 ID 和组 ID 运行进程。
--userns keep-id 标志确保当前用户 ID 映射到容器内的非 root 用户 ID。
这能正确映射绑定挂载目录的权限,使运行 Podman 的用户与容器内运行 Jellyfin 用户的权限保持一致。
请注意,--label "io.containers.autoupdate=image" 标志将允许容器通过 podman auto-update 自动更新,若需恢复旧版本则必须进行备份。
卷选项 z(共享卷)或 Z(私有卷)以及挂载选项 relabel=shared 或 relabel=private 会指示 Podman 重新标记卷内文件,这对运行 SELinux 的系统是必需的。
如需使用绑定挂载,请将 jellyfin-config 和 jellyfin-cache 替换为 /path/to/config 和 /path/to/cache。
此示例通过设置 ro=true 将媒体库挂载为只读模式;如需授予 Jellyfin 写入权限,请改为设置 ro=false。
Managing via systemd
To run as a systemd service see podman-systemd.unit.
As always it is recommended to run the container rootless. Therefore we want to manage the container with the systemd --user flag.
-
Create a new user that the rootless container will run under.
useradd jellyfinThis allows users who are not logged in to run long-running services.
loginctl enable-linger jellyfinOpen an interactive shell session.
machinectl shell jellyfin@ -
Install
.config/containers/systemd/jellyfin.containerContents of
~/.config/containers/systemd/jellyfin.container[Container]Image=docker.io/jellyfin/jellyfin:latestAutoUpdate=registryPublishPort=8096:8096/tcpUserNS=keep-idVolume=jellyfin-config:/config:ZVolume=jellyfin-cache:/cache:ZVolume=jellyfin-media:/media:Z[Service]# Inform systemd of additional exit statusSuccessExitStatus=0 143[Install]# Start by default on bootWantedBy=default.target -
Reload daemon and start the service.
systemctl --user daemon-reloadsystemctl --user start jellyfin -
To enable Podman auto-updates, enable the necessary systemd timer.
systemctl --user enable --now podman-auto-update.timer -
Optionally check logs for errors
journalctl --user -u jellyfin -
exitthe current session.
Using hardware acceleration
To use hardware acceleration, you need to allow the container to access the render device. If you are using container-selinux-2.226 or later, you have to set the container_use_dri_devices flag in selinux or the container will not be able to use it:
sudo setsebool -P container_use_dri_devices 1
On older versions of container-selinux, you have to disable the selinux confinement for the container by adding --security-opt label=disable to the podman command.
Then, you need to mount the render device inside the container:
--device /dev/dri/:/dev/dri/
Finally, you need to set the --device flag for the container to use the render device:
--device /dev/dri/
Podman run example:
podman run \
--detach \
--label "io.containers.autoupdate=registry" \
--name myjellyfin \
--publish 8096:8096/tcp \
--device /dev/dri/:/dev/dri/ \
# --security-opt label=disable # Only needed for older versions of container-selinux < 2.226
--rm \
--user $(id -u):$(id -g) \
--userns keep-id \
--volume jellyfin-cache:/cache:Z \
--volume jellyfin-config:/config:Z \
--mount type=bind,source=/path/to/media,destination=/media,ro=true,relabel=private \
docker.io/jellyfin/jellyfin:latest
systemd example:
[Unit]
Description=jellyfin
[Container]
Image=docker.io/jellyfin/jellyfin:latest
AutoUpdate=registry
PublishPort=8096:8096/tcp
UserNS=keep-id
#SecurityLabelDisable=true # Only needed for older versions of container-selinux < 2.226
AddDevice=/dev/dri/:/dev/dri/
Volume=jellyfin-config:/config:Z
Volume=jellyfin-cache:/cache:Z
Volume=jellyfin-media:/media:Z
[Service]
# Inform systemd of additional exit status
SuccessExitStatus=0 143
[Install]
# Start by default on boot
WantedBy=default.target
Vendor-specific configuration
Additional configuration steps may be required depending on your GPU vendor. Check the Hardware Acceleration section.