nvidia-docker2 is the old way to install. It is no longer part of Ubuntu or Lambda stack.
Here is a tutorial on the current way:
If you really need nvidia-docker2, I have just tested it on my machine (which I grant is on newer test version of Lambda-stack for desktops/GeForce). Worked and did not conflict.
From:
The following seemed to work and no longer conflict:
$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
$ curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
$ curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
$ sudo vi /etc/apt/preferences.d/nvidia-docker-pin-1002
- add the lines
$ sudo apt-get update
$ sudo apt-get install nvidia-docker2
That shows me:
The following additional packages will be installed:
libnvidia-container-tools libnvidia-container1 nvidia-container-toolkit
The following NEW packages will be installed:
nvidia-docker2
The following packages will be upgraded:
libnvidia-container-tools libnvidia-container1 nvidia-container-toolkit
3 upgraded, 1 newly installed, 0 to remove and 7 not upgraded.
Need to get 1,932 kB of archives.
After this operation, 5,163 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64 libnvidia-container-tools 1.8.1-1 [23.4 kB]
Get:2 https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64 libnvidia-container1 1.8.1-1 [926 kB]
Get:3 https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64 nvidia-container-toolkit 1.8.1-1 [978 kB]
Get:4 https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64 nvidia-docker2 2.9.1-1 [5,536 B]
…
But with Lambda Stack generally you should not need the nvidia-docker2. And just use the:
$ sudo apt-get install -y docker.io nvidia-container-toolkit
(or docker-compose, etc if you use that)
But now I have:
/usr/bin/docker - from docker.io
/usr/bin/nvidia-docker - from nvidia-docker2
I know previous versions did conflict of nvidia-docker2 - so this is a improvement for me.