You can indeed install that within the container, but, next time you start the container, it will be gone.
To make it permanent, you need to create a Dockerfile and put in the commands to add it in. Just extend the container and build your own image.
I am told the latest Nextcloud app on truenas, if you don’t want to roll
your own build, included an option on the app config screen to add smbclient and some other stuff.
I don’t use smbclient with docker/nextcloud anymore.
I installed an FTP server in docker (kibatic/proftpd) to share directories that are also SMB shares, external storage with FTP on nextcloud there is no problem, everything works fine and it’s native.