We have a Dockerfile that uses an nvidia container as its base layer, and then at some point later copies the following shell script into a layer and then runs it:
wget -q -O ZED_SDK_Linux_Ubuntu.run https://download.stereolabs.com/zedsdk/4.0/cu118/ubuntu20
chmod +x ZED_SDK_Linux_Ubuntu.run
./ZED_SDK_Linux_Ubuntu.run -- silent skip_python skip_cuda
chmod -R +777 /usr/local/zed
ln -sf /lib/x86_64-linux-gnu/libusb-1.0.so.0 /usr/lib/x86_64-linux-gnu/libusb-1.0.so
rm ZED_SDK_Linux_Ubuntu.run
this skip installing cuda, but unfortunately the following line of linux_install_release.sh
runs no matter what:
# Ensure the libs are accessible
sudo chmod a+rx -R "/usr/local/cuda/lib64/"*
Because any chmod/chown operation in a docker command increases layer sizes in docker, this causes the ZED layer to be an extra ~2.1gb in size, with no way to avoid it. (see filesize - Why does chown increase size of docker image? - Stack Overflow)
I think if --skip-cuda has been set, any manipulation of the cuda directories should be skipped entirely and ensuring cuda is available should be on the user.