Installer causes Docker layer to duplicate cuda libraries even with --skip-cuda

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 
chmod +x 
./ -- silent skip_python skip_cuda
chmod -R +777 /usr/local/zed
ln -sf /lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ 

this skip installing cuda, but unfortunately the following line of 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.


By the way this problem exists in the official stereolabs Docker images, using the dive analysis tool calls it out pretty clearly:

Thank you for the documented report, I didn’t suspect this was causing such a huge size difference. We’ll fix the install script and keep this in mind for the next docker image build.