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

**URL:** <https://community.stereolabs.com/t/installer-causes-docker-layer-to-duplicate-cuda-libraries-even-with-skip-cuda/2665>\
**Category:** Docker\
**Created:** [May 24, 2023, 4:22pm UTC](https://community.stereolabs.com/t/installer-causes-docker-layer-to-duplicate-cuda-libraries-even-with-skip-cuda/2665 "2023-05-24T16:22:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbcpollak](https://community.stereolabs.com/user_avatar/community.stereolabs.com/jbcpollak/32/1299_2.png) [@jbcpollak](https://community.stereolabs.com/u/jbcpollak)\
**Post date:** [May 24, 2023, 4:22pm UTC](https://community.stereolabs.com/t/installer-causes-docker-layer-to-duplicate-cuda-libraries-even-with-skip-cuda/2665/1 "2023-05-24T16:22:15Z")

</div>

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:

```auto
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:

```auto
    # 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](https://stackoverflow.com/questions/30085621/why-does-chown-increase-size-of-docker-image))

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.

---

<div class="post-metadata">

**Author:** ![jbcpollak](https://community.stereolabs.com/user_avatar/community.stereolabs.com/jbcpollak/32/1299_2.png) [@jbcpollak](https://community.stereolabs.com/u/jbcpollak)\
**Post date:** [May 24, 2023, 4:34pm UTC](https://community.stereolabs.com/t/installer-causes-docker-layer-to-duplicate-cuda-libraries-even-with-skip-cuda/2665/2 "2023-05-24T16:34:24Z")

</div>

By the way this problem exists in the official stereolabs Docker images, using the [`dive` analysis tool](https://github.com/wagoodman/dive) calls it out pretty clearly:

 ![image](https://community.stereolabs.com/uploads/default/original/2X/e/e74d38afe75ef2f75f3d624dd80309defd6a7d88.jpeg)

---

<div class="post-metadata">

**Author:** ![adujardin](https://community.stereolabs.com/user_avatar/community.stereolabs.com/adujardin/32/4125_2.png) [@adujardin](https://community.stereolabs.com/u/adujardin)\
**Post date:** [May 25, 2023, 9:16am UTC](https://community.stereolabs.com/t/installer-causes-docker-layer-to-duplicate-cuda-libraries-even-with-skip-cuda/2665/3 "2023-05-25T09:16:39Z")

</div>

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.
