I typically work on a Mac, but a company I’m doing some work for gave their developers Windows machines to develop a php/mysql software application.
Typically when I’m developing locally, I can just mount my local code to the container code. So it’s super simple if I want to make changes.
Enter Windows sub filesystem for linux crap.
I’ve been trying for months to be able to write code in my IDE (phpstorm) and reload localhost and have it not take 30 seconds for a single page load.
I’m looking for any help on how I can make sure the devs can write code and immediately see that code change locally on their docker container from localhost.
Are you using Docker Desktop, or are you running Docker-CE inside a WSL2 distribution?
I am working with a customer laptop with Win10. Recent versions of Windows Subsystem for Linux have built-in support for UI applications and even allow using systemd. I run docker-ce and intellij ultimate (if I am not mistaken phpstorm is just a flavor of it) inside the WSL2 distribution. It works like a charm: systemd starts docker-ce when I start the distribution; when Intellij is started it is rendered as RDP Connection on the Windows host (runs perfectly fine on a 4k screen). Setting up Intellij inside WSL2 requires a bunch of packages to be installed (I can check the exact packages tomorrow)…
The customer also provides access to Docker Desktop for Windows and Intellij for Windows, but I prefer to work in a Linux environment.
Note: you could also map Windows folders into containers, though it is slow compared to directly working inside the WSL distribution. Or you could use IntelliJ on the Windows Host and have the code in the WSL distribution, but it’s no joy either: intellij is always re-indexing. I never got warm with their remote access methods or gateway either.
For me running docker-ce and intellij inside the wsl2 distribution provides the best experience.
You can do the same with Windows: docker run --rm -ti -v d:\winfolder:/test alpine ls /test will list the content of my d:\winfolder inside the alpine container. Give it a try. If you feel things are slower than they should be, you can still move everything inside a WSL2 distro.
What kind of Info are you looking for? I am perfectly happy with Intellij + docker-ce inside a WSL2 Ubuntu 22.04 distribution.
With vscode it’s even simpler. Just install it on the host and use the wsl remote integration. I assume this is what you did … I have no idea why jetbrains isn’t capable to create an identical experience for wsl integrations.
If you want to run intellij variations inside the WSL integration, I already posted the required dependencies in an earlier post. Of course, you would still need to install phpstorm for Linux inside the disto.
When working with different operating systems and facing challenges with code synchronization and performance in Docker containers. Ensure that Dockers volume sharing is correctly set up between the Mac and the Windows machine, allowing for effective code mounting. Verify the configuration to ensure the necessary directories are properly shared. Consider using Docker desktop for Mac, which provides a more optimized and seamless experience for running Docker containers on macOS.