Finally, I have found the answer to this question.
I checked for the volume mappings for my running Docker container using this command
docker inspect <container_id>
In the output you should see a "Mounts" section which looks something like this :
"Mounts": [
{
"Type": "bind",
"Source": "C:\\Users\\myUser\\Files\\AEMMainInstance\\dispatcher\\bin\\..\\lib",
"Destination": "/usr/lib/dispatcher-sdk",
"Mode": "ro",
"RW": false,
"Propagation": "rprivate"
},{
"Type": "bind",
"Source": "C:\\Users\\myUser\\Files\\AEMMainInstance\\dispatcher\\src",
"Destination": "/mnt/dev/src",
"Mode": "ro",
"RW": false,
"Propagation": "rprivate"
},
]
There was no "mount" defined for the path "/mnt/var/www/html" which is the path to my docroot. So, I changed the docer_run.cmd script to add a new mount to specify the mapping for "/mnt/var/www/html".
Add this line in your docker_run.cmd and it will add the mount for you.
set volumes=-v C:\Users\yourUser\Files\AEMMainInstance\dispatcher\cache:/mnt/var/www/html:rw !volumes!
Restart your docker and try to hit a page from your dispatcher. And you check your local directory that you used for mapping to see how the caching is happening.