Using GPU from a docker container?

后端 未结 10 1746
名媛妹妹
名媛妹妹 2020-11-27 09:12

I\'m searching for a way to use the GPU from inside a docker container.

The container will execute arbitrary code so i don\'t want to use the privileged mode.

<
10条回答
  •  广开言路
    2020-11-27 09:25

    Use x11docker by mviereck:

    https://github.com/mviereck/x11docker#hardware-acceleration says

    Hardware acceleration

    Hardware acceleration for OpenGL is possible with option -g, --gpu.

    This will work out of the box in most cases with open source drivers on host. Otherwise have a look at wiki: feature dependencies. Closed source NVIDIA drivers need some setup and support less x11docker X server options.

    This script is really convenient as it handles all the configuration and setup. Running a docker image on X with gpu is as simple as

    x11docker --gpu imagename
    

提交回复
热议问题