emby

emby开心版

docker-compose参考文档

version: '3' 

networks:
  traefik:
    driver: bridge      # 使用桥接模式的网络驱动
    external: true      # 表明这个网络是外部创建的,不由这个 Docker Compose 文件管理

services:
  emby:
    image: lovechen/embyserver:latest  # 使用最新版本的 lovechen/embyserver 镜像
    container_name: emby               # 容器名称设置为 emby
    restart: always                    # 容器总是重新启动
    networks:
      - traefik                       # 将此服务连接到 traefik 网络
    ports:
      - '8096:8096'                   # 将容器的 8096 端口映射到主机的 8096 端口
      - '8920:8920'                   # 将容器的 8920 端口映射到主机的 8920 端口
      - '1900:1900/udp'               # 将容器的 1900 UDP 端口映射到主机的 1900 UDP 端口
      - '7359:7359/udp'               # 将容器的 7359 UDP 端口映射到主机的 7359 UDP 端口
    volumes:
      - ./config:/config              # 将主机上的 ./config 目录挂载到容器的 /config
      - /pt/downloads/link:/data      # 将主机上的 /pt/downloads/link 目录挂载到容器的 /data
      - /etc/timezone:/etc/timezone   # 同步主机和容器的时区设置
      - /etc/localtime:/etc/localtime # 同步主机和容器的本地时间
    environment:
      - UID=0                         # 设置容器用户 ID 为 0 (通常是 root)
      - GID=0                         # 设置容器组 ID 为 0 (通常是 root)
      - GIDLIST=0                     # 设置容器组 ID 列表为 0
      - NVIDIA_VISIBLE_DEVICES=all    # 允许容器访问所有 NVIDIA 设备
    devices:
      - /dev/dri:/dev/dri             # 将主机的 /dev/dri 设备挂载到容器
    deploy:
      resources:
        reservations:
          devices:
          - driver: nvidia            # 指定使用 NVIDIA 驱动
            count: all                # 使用所有可用的 GPU
            capabilities: [gpu]       # 指定 GPU 能力
    labels:
      - "diun.enable=true"            # 特定的标签,可能用于监控或其他目的
      - "traefik.enable=false"        # 禁用 Traefik 自动配置此服务
      - "traefik.docker.network=traefik"
      - "traefik.http.routers.emby.tls=true"
      - "traefik.http.routers.emby.entryPoints=https"
      - "traefik.http.services.emby.loadbalancer.server.port=8096"

启动时报错Error could not select device driver ““ with capabilities: [[gpu]]

参考文章

distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list

sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker