之前我们在centos/ubuntu上安装过nvidia-container-runtime,配置也都是在docker中配置的,那么我们最近本地环境整体从docker换成了containerd,那么今天就来记录下在containerd中如何配置默认的runc到nvidia的container runtime。
安装的话还是可以查看以前的笔记
centos7安装:https://sulao.cn/post/942.html
ubuntu安装:https://sulao.cn/post/919.html
接下来修改/etc/containerd/config.toml文件。
修改plugins."io.containerd.runtime.v1.linux"的配置,修改runtime为nvidia-container-runtime
[plugins."io.containerd.runtime.v1.linux"] runtime = "nvidia-container-runtime" no_shim = false shim_debug = false shim = "containerd-shim" runtime_root = ""
修改plugins."io.containerd.grpc.v1.cri".containerd配置,修改default_runtime_name为nvidia
[plugins."io.containerd.grpc.v1.cri".containerd] disable_snapshot_annotations = true ignore_blockio_not_enabled_errors = false default_runtime_name = "nvidia" ignore_rdt_not_enabled_errors = false discard_unpacked_layers = false snapshotter = "overlayfs" no_pivot = false
新增plugins."io.containerd.grpc.v1.cri".containerd.runtimes.nvidia和对应的options配置
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.nvidia] privileged_without_host_devices = false runtime_engine = "" runtime_root = "" runtime_type = "io.containerd.runc.v2" [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.nvidia.options] BinaryName = "/usr/bin/nvidia-container-runtime" SystemdCgroup = true
以上配置修改以后我们重启下containerd检查下
systemctl daemon-reload systemctl restart containerd containerd config dump #检查配置