This is kind of embarrassing but apparently I failed to read the documentation properly. The issue was that rancher is for testing/development purposes only in docker container mode. Once I installed a local k3s cluster and added rancher on top of that, I was able to install longhorn easily as specified in the docs.
k3s
rancher
longhorn (make sure you have met the pre-requisites)
Here's the note on docker installation:
The Docker installation is for development and testing environments only.