Solving the issue: Docker Runtime ‘nvidia’ not found

Shasha Feng
2 min readFeb 12, 2022

So I have been a Docker fan and I usually run OpenMM within Docker for MD simulations (see post here). One day I installed all the new updates on Ubuntu 20.04 LTS and then I came back later, boom, I cannot restart my container anymore which uses ‘nvidia’ runtime.

$ docker run -it — rm — mount source=simu_vol,target=/data — runtime nvidia — name ommcuda_app sha256feng/openmm-with-cuda /bin/bashdocker: Error response from daemon: Unknown runtime specified nvidia.
See ‘docker run — help’.

Indeed, the nvidia runtime is missing:

$ docker info|grep -i runtime
Runtimes: runc
WARNING: No swap limit support
Default Runtime: runc

To install this runtime, initially, I tried to install it with the command `sudo apt-get install nvidia-container-toolkit`, but failed. Later I solved the problem by checking out Github issues (here and here), where developers suggest using the following code to reproduce errors: amazingly solved the problem.

$ DIST=$(. /etc/os-release; echo $ID$VERSION_ID)
$ curl -s -L https://nvidia.github.io/libnvidia-container/gpgkey | \
sudo apt-key add -
$curl -s -L https://nvidia.github.io/libnvidia-container/$DIST/libnvidia-container.list | \
sudo tee /etc/apt/sources.list.d/libnvidia-container.list
$ sudo apt-get update
$ sudo apt-get install nvidia-container-toolkit

Check runtime again: yes, it is here!

$ docker info|grep -i runtime
WARNING: No swap limit support
Runtimes: nvidia runc
Default Runtime: runc

Now I am able to run the Docker container again:

$ docker run -it — rm — mount source=simu_vol,target=/data — runtime nvidia — name ommcuda_app sha256feng/openmm-with-cuda /bin/bashUnable to find image ‘sha256feng/openmm-with-cuda:latest’ locally
latest: Pulling from sha256feng/openmm-with-cuda
7ddbc47eeb70: Already exists
c1bbdc448b72: Already exists
8c3b70e39044: Already exists
45d437916d57: Already exists
d8f1569ddae6: Already exists
de5a2c57c41d: Already exists
ea6f04a00543: Already exists
7b872974e97c: Already exists
1417a48f237b: Pull complete
77b7ad39198c: Pull complete
ffdad4ad1f78: Pull complete
3d7b1ca5daab: Pull complete
Digest: sha256:baa0eb41e7f4b100c4402f6e43c2884f740d23ab0eb42539a184d45cc3f419ec
Status: Downloaded newer image for sha256feng/openmm-with-cuda:latest

Bingo!

--

--