This repository has been archived by the owner on Mar 27, 2024. It is now read-only.
forked from ublue-os/hwe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for using nvidia GPUs inside containers (ublue-os#43)
* feat: Add support for using nvidia GPUs inside containers * feat: Add container runtime config files into general add-ons package * feat: Add config.toml for rootless container support * fix: Keep backup of original nvidia container runtime config.toml
- Loading branch information
1 parent
4b1c5e6
commit 303bf28
Showing
5 changed files
with
123 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
disable-require = false | ||
#swarm-resource = "DOCKER_RESOURCE_GPU" | ||
#accept-nvidia-visible-devices-envvar-when-unprivileged = true | ||
#accept-nvidia-visible-devices-as-volume-mounts = false | ||
|
||
[nvidia-container-cli] | ||
#root = "/run/nvidia/driver" | ||
#path = "/usr/bin/nvidia-container-cli" | ||
environment = [] | ||
#debug = "/var/log/nvidia-container-toolkit.log" | ||
#ldcache = "/etc/ld.so.cache" | ||
load-kmods = true | ||
#no-cgroups = false | ||
no-cgroups = true | ||
#user = "root:video" | ||
ldconfig = "@/sbin/ldconfig" | ||
|
||
[nvidia-container-runtime] | ||
#debug = "/var/log/nvidia-container-runtime.log" | ||
debug = "~/.local/nvidia-container-runtime.log" | ||
log-level = "info" | ||
|
||
# Specify the runtimes to consider. This list is processed in order and the PATH | ||
# searched for matching executables unless the entry is an absolute path. | ||
runtimes = [ | ||
"docker-runc", | ||
"runc", | ||
] | ||
|
||
mode = "auto" | ||
|
||
[nvidia-container-runtime.modes.csv] | ||
|
||
mount-spec-path = "/etc/nvidia-container-runtime/host-files-for-container.d" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Name: ublue-os-nvidia-addons | ||
Version: 0.2 | ||
Release: 1%{?dist} | ||
Summary: Additional files for nvidia driver support | ||
|
||
License: MIT | ||
URL: https://github.com/ublue-os/nvidia | ||
|
||
BuildArch: noarch | ||
Supplements: mokutil policycoreutils | ||
|
||
Source0: public_key.der | ||
Source1: nvidia-container-runtime.repo | ||
Source2: config-rootless.toml | ||
Source3: nvidia-container.pp | ||
|
||
%description | ||
Adds various runtime files for nvidia support. These include a key for importing with mokutil to enable secure boot for nvidia kernel modules | ||
|
||
%prep | ||
%setup -q -c -T | ||
|
||
|
||
%install | ||
# Have different name for *.der in case kmodgenca is needed for creating more keys | ||
install -Dm0644 %{SOURCE0} %{buildroot}%{_sysconfdir}/pki/akmods/certs/akmods-nvidia.der | ||
install -Dm0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/yum.repos.d/nvidia-container-runtime.repo | ||
install -Dm0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/nvidia-container-runtime/config-rootless.toml | ||
install -Dm0644 %{SOURCE3} %{buildroot}%{_datadir}/selinux/packages/nvidia-container.pp | ||
|
||
sed -i 's@enabled=1@enabled=0@g' %{buildroot}%{_sysconfdir}/yum.repos.d/nvidia-container-runtime.repo | ||
|
||
%files | ||
%attr(0644,root,root) %{_sysconfdir}/pki/akmods/certs/akmods-nvidia.der | ||
%attr(0644,root,root) %{_sysconfdir}/yum.repos.d/nvidia-container-runtime.repo | ||
%attr(0644,root,root) %{_sysconfdir}/nvidia-container-runtime/config-rootless.toml | ||
%attr(0644,root,root) %{_datadir}/selinux/packages/nvidia-container.pp | ||
|
||
%changelog | ||
* Thu Feb 16 2023 Joshua Stone <[email protected]> - 0.2 | ||
- Add nvidia-container-runtime repo | ||
- Add nvidia-container-runtime selinux policy file | ||
- Re-purpose into a general-purpose add-on package | ||
- Update URL to point to ublue-os project | ||
|
||
* Fri Feb 03 2023 Joshua Stone <[email protected]> - 0.1 | ||
- Add key for enrolling kernel modules in alpha builds |