I am running a docker container locally and it's running very slowly.
I use Windows 10 and WSL 2.
I use the app folder as volume.
Without volume, it's running better.
I use this command: docker-compose up -d --build
Souvik, I have first a general suggestion (for you and anyone finding this discussion), then I have a specific suggestion for your specific situation.
1: First, it may help to know more about where this slowness is happening. You may presume it's a cf problem (since you bring it up here), but it could just as well be a docker configuration issue, or indeed specifically a docker volume issue.
As with any problem like this, you need to know if the page is running slowly in cf. At a minimum, have you enabled the debug output feature in the cf admin--or via the json file created with cfsetup, since you're using cf2021? (Indeed, are you using the Adobe image or perhaps the Ortus Commandbox one? They are different, and can be configured differently.)
If you've done that and it confirms the slowness is indeed WITHIN the cf page, have you enabled any cf monitoring, which can provide even more insight into performance aspects within a running request and of cf in general? There are either the cf PMT or fusionreactor as alternatives, and I show how to use those with CF docker images via my awesome-cf-compose site.
If instead somehow these confirm that the slowness is NOT in the cf page, we would need to consider other diagnostics (whether in docker or the linux container running within wsl).
There are just so many potential problems, so let us know what you may find and we can try to take it from there.
2: Second and finally, if it helps to hear, I've certainly run a cf page using a volume for cf code, run on windows 10 and wsl, without ANY slowness.
But more specifically to your challenge, note that my awesome-cf-compose site shows dozens of such examples (compose files using cf images with a volume for the cf code).
Pick any and see if THOSE work well for you. If so, then reconcile whatever differences you have in your compose file, dockerfile, image, volume config, etc.
Looking forward to seeing this solved for you.