/wsl_shellrc

Windows Subsystem for Linux (WSL) PowerShell RC scripts

Primary LanguagePowerShellMIT LicenseMIT

wsl_shellrc

Windows Subsystem for Linux (WSL) rc scripts

Port Forwarding

You should add job scheduler in 'taskschd.msc' to automatically start 'wsl_port_forwarding.ps1'.

Copy 'wsl_servicce_autostarts.bat' to Windows StartUp directory.

Docker Port Forwarding

If you want to forward port for wsl docker as well, you have to add below lines in '~/.profile' or '~/.bashrc'

# start docker daemon automatically when logging in wsl shell
if [ -z "$(ps aux | grep dockerd | grep -v grep)" ] ; then
    wsl_ip=$(ip addr show eth0 | grep -oP "(?<=inet\s)\d+(\.\d+){3}")
    netsh.exe interface portproxy add v4tov4 listenport=2375 connectport=2375 connectaddress=$wsl_ip
    wsl.exe -d Ubuntu -u root -e dockerd -H tcp://$wsl_ip >/dev/null 2>&1 & disown
fi