Docker build on Jetson Xavier

I’m trying to build a docker image that uses pytorch. I use the existing image as the base, but it cannot run a simple command. My Dockerfile is:

FROM nvcr.io/nvidia/l4t-pytorch:r32.5.0-pth1.7-py3

SHELL ["/bin/bash", "-c"]

RUN echo $SHELL

RUN python3 -c 'import torch;print(torch.cuda.is_available());print(torch.cuda.get_device_name(torch.cuda.current_device()));'

A docker build . command creates the following error:

@nvidia-edge:~/Git/Docker$ docker build .
Sending build context to Docker daemon   2.56kB
Step 1/4 : FROM nvcr.io/nvidia/l4t-pytorch:r32.5.0-pth1.7-py3
 ---> f27ad092c6d1
Step 2/4 : SHELL ["/bin/bash", "-c"]
 ---> Running in 0ec8104a16cf
Removing intermediate container 0ec8104a16cf
 ---> f85c5aa20ecf
Step 3/4 : RUN echo $SHELL
 ---> Running in f38447fba45b
/bin/bash
Removing intermediate container f38447fba45b
 ---> 45fdad818599
Step 4/4 : RUN python3 -c 'import torch;print(torch.cuda.is_available());print(torch.cuda.get_device_name(torch.cuda.current_device()));'
 ---> Running in 0f50227984c6
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/torch/__init__.py", line 189, in <module>
    _load_global_deps()
  File "/usr/local/lib/python3.6/dist-packages/torch/__init__.py", line 142, in _load_global_deps
    ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
  File "/usr/lib/python3.6/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libcurand.so.10: cannot open shared object file: No such file or directory
The command '/bin/bash -c python3 -c 'import torch;print(torch.cuda.is_available());print(torch.cuda.get_device_name(torch.cuda.current_device()));'' returned a non-zero code: 1

Am I missing something?

Thank you

1 Like

Hi @giannisp, since you are trying to use CUDA during building the container, have you set your Docker daemon’s default-runtime to nvidia?

See here to enable it: https://github.com/dusty-nv/jetson-containers#docker-default-runtime

Remember to reboot or restart your Docker service after making the changes.

2 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.