Last active
March 14, 2021 16:14
-
-
Save tomasfejfar/c3ac0d795dfadb13b7ef813d3e9410d3 to your computer and use it in GitHub Desktop.
WSL2 docker setup for Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# based on https://susi.dev/dev-env-2020#5-use-systemd-hack-to-use-snap-optional-be-careful | |
# in windows | |
& 'C:\Program Files\VcXsrv\vcxsrv.exe' :0 -multiwindow -wgl -ac -silent-dup-error | |
# add firewall rule | |
netsh advfirewall firewall add rule name="XServer" dir=in program="C:\program files\vcxsrv\vcxsrv.exe" protocol=TCP localport=6000 action=allow profile=private remoteip=localsubnet | |
# in ubuntu | |
sudo apt-get update && sudo apt-get install -yqq daemonize dbus-user-session fontconfig | |
sudo daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target | |
exec sudo nsenter -t $(pidof systemd) -a su - $LOGNAME | |
snap version | |
# in ubuntu export DISPLYA variable | |
export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0 | |
export LIBGL_ALWAYS_INDIRECT=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://www.hanselman.com/blog/how-to-set-up-docker-within-windows-system-for-linux-wsl2-on-windows-10