neko/webpage/docs/installation/examples.md
2025-04-05 21:45:19 +02:00

6.6 KiB

description
Example Docker Compose configurations for Neko.

Examples

Here are some examples to get you started with Neko. You can use these examples as a reference to create your own configurations.

Firefox

services:
  neko:
    image: "ghcr.io/m1k1o/neko/firefox:latest"
    restart: "unless-stopped"
    shm_size: "2gb"
    ports:
      - "8080:8080"
      - "52000-52100:52000-52100/udp"
    volumes:
      - <your-host-path>:/home/neko/.mozilla/firefox # persist firexfox settings
    environment:
      NEKO_DESKTOP_SCREEN: '1920x1080@30'
      NEKO_MEMBER_MULTIUSER_USER_PASSWORD: neko
      NEKO_MEMBER_MULTIUSER_ADMIN_PASSWORD: admin
      NEKO_WEBRTC_EPR: 52000-52100
      NEKO_WEBRTC_ICELITE: 1
      NEKO_WEBRTC_NAT1TO1: <your-IP>

Chromium

services:
  neko:
    image: "ghcr.io/m1k1o/neko/chromium:latest"
    restart: "unless-stopped"
    shm_size: "2gb"
    cap_add:
      - SYS_ADMIN
    ports:
      - "8080:8080"
      - "52000-52100:52000-52100/udp"
    volumes:
      - <your-host-path>:/home/neko/.config/chromium # persist chromium settings
    environment:
      NEKO_DESKTOP_SCREEN: '1920x1080@30'
      NEKO_MEMBER_MULTIUSER_USER_PASSWORD: neko
      NEKO_MEMBER_MULTIUSER_ADMIN_PASSWORD: admin
      NEKO_WEBRTC_EPR: 52000-52100
      NEKO_WEBRTC_ICELITE: 1
      NEKO_WEBRTC_NAT1TO1: <your-IP>

VLC

services:
  neko:
    image: "ghcr.io/m1k1o/neko/vlc:latest"
    restart: "unless-stopped"
    shm_size: "2gb"
    cap_add:
      - SYS_ADMIN
    volumes:
      - "<your-video-folder>:/video" # mount your video folder
    ports:
      - "8080:8080"
      - "52000-52100:52000-52100/udp"
    environment:
      NEKO_DESKTOP_SCREEN: '1920x1080@30'
      NEKO_MEMBER_MULTIUSER_USER_PASSWORD: neko
      NEKO_MEMBER_MULTIUSER_ADMIN_PASSWORD: admin
      NEKO_WEBRTC_EPR: 52000-52100
      NEKO_WEBRTC_ICELITE: 1
      NEKO_WEBRTC_NAT1TO1: <your-IP>

Raspberry Pi GPU Acceleration

services:
  neko:
    image: "ghcr.io/m1k1o/neko/chromium:latest"
    restart: "unless-stopped"
    # increase on rpi's with more then 1gb ram.
    shm_size: "520mb"
    ports:
      - "8088:8080"
      - "52000-52100:52000-52100/udp"
    # note: this is important since we need a GPU for hardware acceleration alternatively
    #       mount the devices into the docker.
    privileged: true
    environment:
      NEKO_CAPTURE_VIDEO_PIPELINE: |
        ximagesrc display-name={display} show-pointer=true use-damage=false
          ! video/x-raw,framerate=25/1
          ! videoconvert ! queue
          ! video/x-raw,format=NV12
          ! v4l2h264enc
            name=encoder
            extra-controls="controls,h264_profile=1,video_bitrate=1250000;"
          ! h264parse config-interval=-1
          ! video/x-h264,stream-format=byte-stream
          ! appsink name=appsink
      NEKO_CAPTURE_VIDEO_CODEC: "h264"
      NEKO_DESKTOP_SCREEN: '1280x720@30'
      NEKO_MEMBER_MULTIUSER_USER_PASSWORD: neko
      NEKO_MEMBER_MULTIUSER_ADMIN_PASSWORD: admin
      NEKO_WEBRTC_EPR: 52000-52100
      NEKO_WEBRTC_ICELITE: 1

Nvidia GPU Acceleration

Neko supports hardware acceleration using Nvidia GPUs. To use this feature, you need to have the Nvidia Container Toolkit installed on your system. You can find the installation instructions here.

This example shows how to accelerate video encoding and as well the browser rendering using the GPU. You can test if the GPU is used by running nvidia-smi, which should show the GPU usage of both the browser and neko. In the browser, you can run the WebGL Aquarium Demo to test the GPU usage.

services:
  neko:
    image: "ghcr.io/m1k1o/neko/nvidia-firefox:latest"
    restart: "unless-stopped"
    shm_size: "2gb"
    ports:
      - "8080:8080"
      - "52000-52100:52000-52100/udp"
    environment:
      NEKO_CAPTURE_VIDEO_PIPELINE: |
        ximagesrc display-name={display} show-pointer=true use-damage=false
          ! video/x-raw,framerate=25/1
          ! videoconvert ! queue
          ! video/x-raw,format=NV12
          ! nvh264enc
            name=encoder
            preset=2
            gop-size=25
            spatial-aq=true
            temporal-aq=true
            bitrate=4096
            vbv-buffer-size=4096
            rc-mode=6
          ! h264parse config-interval=-1
          ! video/x-h264,stream-format=byte-stream
          ! appsink name=appsink
      NEKO_CAPTURE_VIDEO_CODEC: "h264"
      NEKO_DESKTOP_SCREEN: 1920x1080@30
      NEKO_MEMBER_MULTIUSER_USER_PASSWORD: neko
      NEKO_MEMBER_MULTIUSER_ADMIN_PASSWORD: admin
      NEKO_WEBRTC_EPR: 52000-52100
      NEKO_WEBRTC_ICELITE: 1
    deploy:
      resources:
        reservations:
          devices:
          - driver: nvidia
            count: 1
            capabilities: [gpu]

See available Nvidia Docker Images.

If you only want to accelerate the encoding, not the browser rendering, you can use the default image with additional environment variables:

services:
  neko:
    # highlight-next-line
    image: "ghcr.io/m1k1o/neko/firefox:latest"
    restart: "unless-stopped"
    shm_size: "2gb"
    ports:
      - "8080:8080"
      - "52000-52100:52000-52100/udp"
    environment:
      # highlight-start
      NVIDIA_VISIBLE_DEVICES: all
      NVIDIA_DRIVER_CAPABILITIES: all
      # highlight-end
      NEKO_CAPTURE_VIDEO_PIPELINE: |
        ximagesrc display-name={display} show-pointer=true use-damage=false
          ! video/x-raw,framerate=25/1
          ! videoconvert ! queue
          ! video/x-raw,format=NV12
          ! nvh264enc
            name=encoder
            preset=2
            gop-size=25
            spatial-aq=true
            temporal-aq=true
            bitrate=4096
            vbv-buffer-size=4096
            rc-mode=6
          ! h264parse config-interval=-1
          ! video/x-h264,stream-format=byte-stream
          ! appsink name=appsink
      NEKO_CAPTURE_VIDEO_CODEC: "h264"
      NEKO_DESKTOP_SCREEN: 1920x1080@30
      NEKO_MEMBER_MULTIUSER_USER_PASSWORD: neko
      NEKO_MEMBER_MULTIUSER_ADMIN_PASSWORD: admin
      NEKO_WEBRTC_EPR: 52000-52100
      NEKO_WEBRTC_ICELITE: 1
    deploy:
      resources:
        reservations:
          devices:
          - driver: nvidia
            count: 1
            capabilities: [gpu]