Look at how the volumes are configured here:
https://help.nextcloud.com/t/howto-ubuntu-docker-nextcloud-talk-collabora/76430
You can mount them to external storage the same way.
The general format is
hostpath:containerpath
where hostpath is the path to the folder on the host, and containerpath is where that should be mounted inside the container. You can put hostpath anywhere you like, such as on a mounted external drive.