Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master nvidia #64

Merged
merged 2 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RUN \

FROM ghcr.io/linuxserver/baseimage-alpine:3.19 as buildstage

ARG KASMVNC_RELEASE="d49d07b88113d28eb183ca7c0ca59990fae1153c"
ARG KASMVNC_RELEASE="511e2ae542e95f5447a0a145bb54ced968e6cfec"

COPY --from=wwwstage /build-out /www

Expand Down Expand Up @@ -287,6 +287,8 @@ RUN \
mesa-va-gallium \
mesa-vulkan-ati \
mesa-vulkan-intel \
mesa-vulkan-layers \
mesa-vulkan-swrast \
nginx \
nodejs \
openbox \
Expand All @@ -308,6 +310,7 @@ RUN \
setxkbmap \
sudo \
tar \
vulkan-tools \
xauth \
xf86-video-amdgpu \
xf86-video-ati \
Expand Down
5 changes: 4 additions & 1 deletion Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ RUN \

FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.19 as buildstage

ARG KASMVNC_RELEASE="d49d07b88113d28eb183ca7c0ca59990fae1153c"
ARG KASMVNC_RELEASE="511e2ae542e95f5447a0a145bb54ced968e6cfec"

COPY --from=wwwstage /build-out /www

Expand Down Expand Up @@ -82,7 +82,9 @@ RUN \
mesa-vulkan-ati \
mesa-vulkan-broadcom \
mesa-vulkan-freedreno \
mesa-vulkan-layers \
mesa-vulkan-panfrost \
mesa-vulkan-swrast \
meson \
nettle-dev \
openssl-dev \
Expand Down Expand Up @@ -314,6 +316,7 @@ RUN \
setxkbmap \
sudo \
tar \
vulkan-tools \
xauth \
xf86-video-amdgpu \
xf86-video-ati \
Expand Down
33 changes: 33 additions & 0 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,39 @@ full_custom_readme: |
### Display Compositing (desktop effects)

When using this image in tandem with a supported video card, compositing will function albeit with a performance hit when syncing the frames with pixmaps for the applications using it. This can greatly increase app compatibility if the application in question requires compositing, but requires a real GPU to be mounted into the container. By default we disable compositing at a DE level for performance reasons on our downstream images, but it can be enabled by the user and programs using compositing will still function even if the DE has it disabled in its settings. When building desktop images be sure you understand that with it enabled by default only users that have a compatible GPU mounted in will be able to use your image.

## Nvidia GPU Support

**Nvidia is not compatible with Alpine based images**

Nvidia support is available by leveraging Zink for OpenGL support. This can be enabled with the following run flags:

| Variable | Description |
| :----: | --- |
| --gpus all | This can be filtered down but for most setups this will pass the one Nvidia GPU on the system |
| --runtime nvidia | Specify the Nvidia runtime which mounts drivers and tools in from the host |

The compose syntax is slightly different for this as you will need to set nvidia as the default runtime:

```
sudo nvidia-ctk runtime configure --runtime=docker --set-as-default
sudo service docker restart
```

And to assign the GPU in compose:

```
services:
myimage:
image: myname/myimage:mytag
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [compute,video,graphics,utility]
```

## Lossless

Expand Down
8 changes: 8 additions & 0 deletions root/defaults/startwm.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
#!/usr/bin/env bash

# Enable Nvidia GPU support if detected
if which nvidia-smi; then
export LIBGL_KOPPER_DRI2=1
export MESA_LOADER_DRIVER_OVERRIDE=zink
export GALLIUM_DRIVER=zink
fi

/usr/bin/openbox-session
2 changes: 1 addition & 1 deletion root/etc/s6-overlay/s6-rc.d/svc-kasmvnc/run
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/with-contenv bash

# Pass gpu flags if mounted
if ls /dev/dri/renderD* 1> /dev/null 2>&1 && [ -z ${DISABLE_DRI+x} ]; then
if ls /dev/dri/renderD* 1> /dev/null 2>&1 && [ -z ${DISABLE_DRI+x} ] && ! which nvidia-smi; then
HW3D="-hw3d"
fi
if [ -z ${DRINODE+x} ]; then
Expand Down