Cuda can not work in container

I tested cuda samples in administor, and it works, but it failed in container.

CUDA can work fine in containers, but you need to configure your container properly to have access to the relevant devices and libraries.

LXD makes that reasonably easy, if using LXC, a bit more work is involved but the NVIDIA folks did a very good job with the nvidia hook which does most of this work for you.

Hi,

Can you tell us what instructions are you following?
There are instructions at https://stgraber.org/2017/03/21/cuda-in-lxd/
But for Ubuntu 18.04 the packages are found in the repositories so it’s even easier.