How to use the rocker.nvidia_extension.get_docker_version function in rocker

To help you get started, we’ve selected a few rocker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github osrf / rocker / test / test_nvidia.py View on Github external
self.assertIn('COPY --from=glvnd /usr/share/glvnd/egl_vendor.d/10_nvidia.json /usr/share/glvnd/egl_vendor.d/10_nvidia.json', snippet)

        self.assertIn('NVIDIA_VISIBLE_DEVICES', snippet)
        self.assertIn('NVIDIA_DRIVER_CAPABILITIES', snippet)


        preamble = p.get_preamble(mock_cliargs)
        self.assertIn('FROM nvidia/opengl:1.0-glvnd-devel-', preamble)

        docker_args = p.get_docker_args(mock_cliargs)
        #TODO(tfoote) restore with #37 self.assertIn(' -e DISPLAY -e TERM', docker_args)
        #TODO(tfoote) restore with #37 self.assertIn(' -e QT_X11_NO_MITSHM=1', docker_args)
        #TODO(tfoote) restore with #37 self.assertIn(' -e XAUTHORITY=', docker_args)
        #TODO(tfoote) restore with #37 self.assertIn(' -v /tmp/.X11-unix:/tmp/.X11-unix ', docker_args)
        #TODO(tfoote) restore with #37 self.assertIn(' -v /etc/localtime:/etc/localtime:ro ', docker_args)
        if get_docker_version() >= Version("19.03"):
            self.assertIn(' --gpus all', docker_args)
        else:
            self.assertIn(' --runtime=nvidia', docker_args)