Learn Docker GPU


Work in progress...

Install docker using APT

Troubleshooting

Failed to initialize NVML: Unknown Error

nano /etc/nvidia-container-runtime/config.toml



# Install docker on Ubuntu using Snap

To install Docker on an Ubuntu system using Snap, follow these steps:
```bash
snap install docker --classic

Enable nvidia-docker support using CDI mode

Docker Snap Configuration

The docker snap configuration file is located at:

/var/snap/docker/current/config/daemon.json

once modified, you need to restart the snap service for changes to take effect:

sudo snap restart docker

launch a container with GPU support

NOTE: library path and discovery is automatically handled, but binary paths are not, so if you wish to test using something like the nvidia-smi binary passed into the container from the host, you could either specify the full path or set the PATH environment variable.

docker run --rm --runtime=nvidia --gpus all --env PATH="${PATH}:/var/lib/snapd/hostfs/usr/bin" ubuntu nvidia-smi

Troubleshooting

nvidia-container-cli: initialization error: load library failed: libnvidia-ml.so.1:

Enable cgroup ? (not sure yet)

$ nano /etc/nvidia-container-runtime/config.toml

no-cgroups = true

Ressources

Docker snap - NVIDIA support

snap: edit docker configuration

Installing the NVIDIA Container Toolkit