POSTS / WSL: A localhost proxy configuration was detected but not mirrored into WSL. WSL in NAT mode does not support localhost proxies.
refer to Issue:
- Open or create the wsl configuration file (located at
%USERPROFILE%\.wslconfig
), and enter the following content:[experimental] autoMemoryReclaim=gradual # gradual | dropcache | disabled networkingMode=mirrored dnsTunneling=true firewall=true autoProxy=true
- Open the command prompt and execute
wsl --shutdown
works for me but brought one new problem: my docker engine can’t start in WSL2. if i run a simple
docker
command then i’ll get aThe command 'docker' could not be found in this WSL 2 distro.
i just delete the
.wslconfig
and ignore the warning while starting WSL2…
then following this reply, i tried to set networkingMode=NAT
and autoProxy=false
, but still failed to start docker container with permission error: Ports are not available
.
further check is needed, following links may be helpful:
since i found that WSL cannot use proxies from the host and docker reports
Cannot start Docker Compose application.
Reason: compose [start] exit status 1.
wsl: A localhost proxy configuration was detected but not mirrored into WSL. WSL in NAT mode does not support localhost proxies.
Container ... Starting Error response from daemon:
Ports are not available:
exposing port TCP 127.0.0.1:5901 -> 0.0.0.0:0:
listen tcp 127.0.0.1:5901:
bind: An attempt was made to access a socket in a way forbidden by its access permissions.
then i retry the config mentioned before and this time it works. i think there must be some mystery fixes after i wrote this page. anyway, it works now.