diff --git a/docs/compose-files/docker-compose.default.yml b/docs/compose-files/docker-compose.default.yml index 84db37e..9ad47a3 100644 --- a/docs/compose-files/docker-compose.default.yml +++ b/docs/compose-files/docker-compose.default.yml @@ -36,6 +36,14 @@ services: - /dev/uinput # Add AMD/Intel HW accelerated video encoding/decoding devices (optional) #- /dev/dri + # Add NVIDIA HW accelerated devices (optional - must be run with runc docker runtime. If you use the nvidia runtime, this is not needed) + #- /dev/nvidia0 + #- /dev/nvidiactl + #- /dev/nvidia-modeset + #- /dev/nvidia-uvm + #- /dev/nvidia-uvm-tools + #- /dev/nvidia-caps/nvidia-cap1 + #- /dev/nvidia-caps/nvidia-cap2 # Ensure container access to devices 13:* device_cgroup_rules: - 'c 13:* rmw' diff --git a/docs/ubuntu-server.md b/docs/ubuntu-server.md index cb67410..78b3ccd 100644 --- a/docs/ubuntu-server.md +++ b/docs/ubuntu-server.md @@ -24,6 +24,9 @@ Follow the [official instructions](https://docs.nvidia.com/datacenter/cloud-nati If you do this, ensure that when you configure Docker Compose in the next step you choose the `nvidia` runtime. +Alternately, it is possible to run the container without the NVIDIA runtime by uncommenting the `/dev/nvidia` devices in the Compose file. + + ## CONFIGURE DOCKER COMPOSE: Once you have installed docker, follow the [Compose Files](./docker-compose.md) section and select the right configuration file for your hardware. diff --git a/overlay/etc/cont-init.d/60-configure_gpu_driver.sh b/overlay/etc/cont-init.d/60-configure_gpu_driver.sh index 6954d10..2b05a74 100644 --- a/overlay/etc/cont-init.d/60-configure_gpu_driver.sh +++ b/overlay/etc/cont-init.d/60-configure_gpu_driver.sh @@ -217,6 +217,11 @@ if [ "${nvidia_pci_address:-}X" != "X" ]; then print_header "Found NVIDIA device '${nvidia_gpu_name:?}'" install_nvidia_driver patch_nvidia_driver +elif [ "${NVIDIA_DRIVER_VERSION:-}X" != "X" ]; then + export nvidia_host_driver_version="${NVIDIA_DRIVER_VERSION:?}" + print_header "Forcing install of NVIDIA driver version '${nvidia_host_driver_version:?}' because the 'NVIDIA_DRIVER_VERSION' variable is set." + install_nvidia_driver + patch_nvidia_driver else print_header "No NVIDIA device found" fi diff --git a/overlay/etc/cont-init.d/70-configure_xorg.sh b/overlay/etc/cont-init.d/70-configure_xorg.sh index 0e600dc..64039b4 100644 --- a/overlay/etc/cont-init.d/70-configure_xorg.sh +++ b/overlay/etc/cont-init.d/70-configure_xorg.sh @@ -43,12 +43,18 @@ function configure_nvidia_x_server { connected_monitor="--connected-monitor=${DISPLAY_VIDEO_PORT:?}" fi nvidia-xconfig --virtual="${DISPLAY_SIZEW:?}x${DISPLAY_SIZEH:?}" --depth="${DISPLAY_CDEPTH:?}" --mode=$(echo "${MODELINE:?}" | awk '{print $2}' | tr -d '"') --allow-empty-initial-configuration --no-probe-all-gpus --busid="${bus_id:?}" --no-multigpu --no-sli --no-base-mosaic --only-one-x-screen ${connected_monitor:?} - sed -i '/Driver\s\+"nvidia"/a\ Option "ModeValidation" "NoMaxPClkCheck, NoEdidMaxPClkCheck, NoMaxSizeCheck, NoHorizSyncCheck, NoVertRefreshCheck, NoVirtualSizeCheck, NoTotalSizeCheck, NoDualLinkDVICheck, NoDisplayPortBandwidthCheck, AllowNon3DVisionModes, AllowNonHDMI3DModes, AllowNonEdidModes, NoEdidHDMI2Check, AllowDpInterlaced"\n Option "HardDPMS" "False"' /etc/X11/xorg.conf + # Allow SteamHeadless to run with an eGPU + sed -i '/Driver\s\+"nvidia"/a\ Option "AllowExternalGpus" "True"' /etc/X11/xorg.conf + # Configure primary GPU + sed -i '/Driver\s\+"nvidia"/a\ Option "PrimaryGPU" "yes"' /etc/X11/xorg.conf + # Force X server to start even if no display devices are connected + sed -i '/Driver\s\+"nvidia"/a\ Option "AllowEmptyInitialConfiguration"' /etc/X11/xorg.conf + # Disable some mode validation checks + sed -i '/Driver\s\+"nvidia"/a\ Option "ModeValidation" "NoMaxPClkCheck, NoEdidMaxPClkCheck, NoMaxSizeCheck, NoHorizSyncCheck, NoVertRefreshCheck, NoVirtualSizeCheck, NoTotalSizeCheck, NoDualLinkDVICheck, NoDisplayPortBandwidthCheck, AllowNon3DVisionModes, AllowNonHDMI3DModes, AllowNonEdidModes, NoEdidHDMI2Check, AllowDpInterlaced"' /etc/X11/xorg.conf + # Configure the default modeline sed -i '/Section\s\+"Monitor"/a\ '"${MODELINE}" /etc/X11/xorg.conf # Prevent interference between GPUs echo -e "Section \"ServerFlags\"\n Option \"AutoAddGPU\" \"false\"\nEndSection" | tee -a /etc/X11/xorg.conf > /dev/null - # Configure primary GPU - sed -i '/Driver\s\+"nvidia"/a\ Option "AllowEmptyInitialConfiguration"\n Option "AllowExternalGpus" "true"\n Option "PrimaryGPU" "yes"' /usr/share/X11/xorg.conf.d/nvidia-drm-outputclass.conf } # Allow anybody for running x server