I would like to flatten a docker image by using docker multi-stage. My Dockerfile is something like this:
FROM nvcr.io/nvidia/l4t-tensorrt:r8.2.1-runtime as build
# ...
FROM scratch
COPY --from=build / /
CMD ["/bin/bash"]
However if I try to run this image (even if I use --runtime nvidia
), the Nvidia libraries will not be mounted at runtime. How can I do it?
I solved by adding ENV
instruction to the latest stage. The variables can be retrieved with docker inspect nvcr.io/nvidia/l4t-tensorrt:r8.2.1-runtime