That’s right. Discourse doesn’t know or care where Docker keeps stuff.
You don’t need to keep Discourse in /var/discourse unless you’re hit by a bus and someone else ever needs to help and they’ll spend a long while finding where you put it.
You can put either on whatever volume you like (again, neither Docker nor Discourse really know what volume they are on)