This document is intended to solve the WSL2 slow file read issue via using a docker container bridge to construct a forward file sync from Windows host to docker container volume mirror mount to the WSL2 container.
The development of IDE env will be hosted on Windows session, not WSL2 session.
The hosting / script / test session can be on both Windows / WSL2 session.
The pros and cons of using this method:
Pros:
solve WSL2 slow file read issue with text editor
almost native file read speed
At least it is a alternative fix for a 2 yrs issue
You dont need a linux ext4 drive for this
Cons:
requires docker container volume bridge running during the session
some of the binaries may not be processed or run because of the different host issue, (node_modules bin), you need to setup a custom file sync blacklist and config the file on WSL2 side
need to run dos2unix if you are running .sh files on wsl2 when writing it from windows
PS C:\Users\Engineer> mutagen Mutagen is a remote development tool built on high-performance synchronization
Usage: mutagen [flags] mutagen [command]
Available Commands: sync Create and manage synchronization sessions forward Create and manage forwarding sessions [Experimental] project Orchestrate sessions for a project [Experimental] tunnel Create and manage tunnels [Experimental] login Log in to mutagen.io logout Log out from mutagen.io daemon Control the lifecycle of the Mutagen daemon version Show version information legal Show legal information help Help about any command
Flags: -h, --help Show help information
Use "mutagen [command] --help" for more information about a command.
On WSL2:
goto ~/ , setup mirror path
1 2 3 4 5 6 7 8 9 10 11 12 13
cd ~ mkdir docker-mirrors cd docker-mirrors
# remove UBUNTU_BRIDE container if exists docker rm UBUNTU_BRIDGE # start the session docker run -it -v $PWD:/app --name UBUNTU_BRIDGE ubuntu:20.04 /bin/bash
# In the docker session # config a user with the same user id of WSL2 , default is 1000 adduser ubuntu cd /app # here are the synchronized files
Setup development environment on Windows
goto %HOMEPATH%, default is C:\Users\{YOUR_USERNAME}\
create a default .mutagen.yml, (there is . before the mutagen.yml, make sure you have it), for ignoring node_modules and other files that should only be working on the host (for example linux based binaries)