macOS-like Developer Experience with WSL2, Windows Terminal, VSCode and Docker Desktop

Ad22fcf5773b906c08330f4d57242212?s=47 Kohei Ota
September 10, 2020

macOS-like Developer Experience with WSL2, Windows Terminal, VSCode and Docker Desktop

Talked at microWSLConf 2020

Ad22fcf5773b906c08330f4d57242212?s=128

Kohei Ota

September 10, 2020
Tweet

Transcript

  1. macOS-like Developer Experience with WSL2, Windows Terminal, VSCode and Docker

    Desktop microWSLConf 2020 Kohei Ota, Hewlett Packard Enterprise / CNCF Ambassador GitHub: @inductor, Twitter: @_inductor_
  2. Agenda • What’s macOS like DX? • Tools and where

    they cover • Real world issues and workarounds • Customizing and sharing
  3. This talk does not cover • What are WSL and

    WSL2 ◦ WSL2 architecture and such • How to use macOS • How to use Docker
  4. What’s macOS-like DX? • Runs shell natively • IDE and

    filer integration • Easy tab management just like browsers • Better copy-and-paste experience than classic cmd.exe ◦ Just use Ctrl+C and Ctrl-V • Package management • Runs code quickly and easily! (w/ the power of Docker)
  5. What’s macOS-like DX? • Runs shell natively • IDE and

    filer integration • Easy tab management just like browsers • Better copy-and-paste experience than classic cmd.exe ◦ Just use Ctrl+C and Ctrl-V • Package management • Runs code quickly and easily! (w/ the power of Docker) WSL2 Windows Terminal Homebrew Docker Desktop VSCode
  6. Quick demo

  7. Quick comparison table

  8. Windows vs macOS features comparison macOS Windows Shell environment Native

    WSL2 IDE and filer integration Native VSCode + Bash script Easy tab management Terminal.app / iTerm2 Windows Terminal + Config Copy and Paste (C+C/C+V) Terminal.app / iTerm2 Windows Terminal + Config Package management Homebrew + dotfiles Homebrew + dotfiles Run code quickly and easily Docker Desktop for Mac Docker Desktop for Windows
  9. IDE and filer integration

  10. VSCode Remote + WSL2 • VSCode has supported WSL2 remote

    since the end of 2019 ◦ https://code.visualstudio.com/blogs/2019/09/03/wsl2 • Type ‘code’ in your WSL bash and it will launch VSCode! ◦ https://code.visualstudio.com/docs/remote/wsl-tutorial#_run-in-wsl
  11. Additional tip for IDE • Jetbrains families are actively implementing

    WSL2 environment supports!
  12. Reproduce ‘open’ command in WSL2 • macOS shells support ‘open’

    command to open directories in their filer ◦ e.g. “open .” and it will open the current directory on Finder • In WSL, you just need this one line in your .bashrc :) ◦ alias open="powershell.exe /c start"
  13. Easy tab management

  14. Introduce Windows Terminal • Windows Terminal is a new Terminal

    officially developed by Microsoft ◦ Supports powershell, cmd and WSL background • Fully open source on GitHub ◦ https://github.com/microsoft/terminal • Available on Microsoft Store
  15. Customize Windows Terminal • All settings are configurable with JSON

    format "profiles": { "list": [ { "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}", "hidden": false, "name": "Ubuntu", "source": "Windows.Terminal.Wsl", "startingDirectory": "//wsl$/Ubuntu/home/kela", "fontFace": "Roboto Mono for Powerline" } ] } Set your $HOME for new tabs!
  16. Customize Windows Terminal • All settings are configurable with JSON

    format Copy and Paste Tab management Key bindings "keybindings": [ { "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" }, { "command": "paste", "keys": "ctrl+v" }, { "command": "closeTab", "keys": "ctrl+w" }, { "command": "newTab", "keys": "ctrl+t" }, { "command": "find", "keys": "ctrl+shift+f" }, ]
  17. Package management

  18. Homebrew supports Linux • https://docs.brew.sh/Homebrew-on-Linux ◦ WSL support included! •

    Homebrew installer now runs pure bash and brew contains portable ruby ◦ Better portability and less external dependency
  19. Make your dotfiles • Manage your brew install and bashrc

    changes on GitHub ◦ https://github.com/inductor/dotfiles • When you get a new computer, just run dotfiles installer then you’re all set!
  20. Run code quickly and easily

  21. Docker Desktop for Windows • Now it supports WSL2 on

    Windows 10 Home 1903/1909 • I’d personally recommend Edge channel ◦ New features & performance fixes come more frequently • Developing inside a Container ◦ https://code.visualstudio.com/docs/remote/containers
  22. Real world issues

  23. Memory usage explosion in WSL2

  24. • Set .wslconfig in %UserProfile%\.wslconfig • Here’s my personal setting

    • Available options are on https://docs.microsoft.com/en-us/windows/wsl/wsl-config Memory usage explosion in WSL2 [wsl2] memory=6GB swap=0 processors=4
  25. Windows Filesystem performance issue

  26. • The best workaround right now is not to use

    Windows filesystem • VSCode Remote and Docker and IDE integration with WSL2 make it possible • I strongly recommend the ‘open’ command support if you want to use explorer.exe with working directories! Memory usage explosion in WSL2
  27. Key takeaways Windows has become very developer friendly It’s nice

    to have a workstation that both my favourite software work: Age of Empires 2 and Docker! WSL2 still has problems, but it is already enough for most users who use macOS for Web development Windows Terminal keybindings are powerful WSL2 networking and filesystem shareing is convenient
  28. Thank you!