Developing on Windows with WSL2 (Subsystem for Linux), VS Code, Docker, and the Terminal

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Man, all these videos showcasing wsl2 makes me so impatient waiting for it to get released to regular windows

๐Ÿ‘๏ธŽ︎ 6 ๐Ÿ‘ค๏ธŽ︎ u/metellius ๐Ÿ“…๏ธŽ︎ Sep 15 2019 ๐Ÿ—ซ︎ replies

Is this your video?

๐Ÿ‘๏ธŽ︎ 1 ๐Ÿ‘ค๏ธŽ︎ u/WSL_subreddit_mod ๐Ÿ“…๏ธŽ︎ Sep 14 2019 ๐Ÿ—ซ︎ replies
Captions
hey friends my name is Scott Hanselman now I'm a windows developer I've used Windows for many many years I've also used Mac and Linux for years as well what I keep coming back to Windows because frankly I like Windows maybe you don't and that's fine this video isn't for you but if you're someone who doesn't like Windows because it doesn't let you develop your Linux applications or your open-source applications I'll bet you you like the Windows interface you like the hotkeys you like Explorer and things like that you might be like me in fact I enjoy developing on Windows I enjoy Windows as a user I use Photoshop in different Windows applications but for a long time I wanted to be able to run my Linux apps and my open-source apps so I tried things like cygwin and didn't really work out for me but now that Windows 10 supports the windows subsystem for Linux you can run actual Linux applications on Windows for real and they have a new open source terminal which is really cool it replaces the console and I'll talk about that in a little bit I've started using windows full time it's my main development machine but I'm moving seamlessly between containers and Linux and Windows itself in a way that really hasn't been possible until now so in this video I'm going to show you how to set that up we're gonna get the terminal we're gonna get docker will get wsl to installed using the windows subsystem for linux version 2 that is now out in Windows 10 insiders fast unless you're reading this in the future and it's been developed so let's let's take a look I know I happen to be on insiders fast so I'm using Windows 10 insiders fast you can see here I'm on version 1 8 and 9 8 oh you can actually hit the Windows key and press windows r and type in win ver and see the build that you have this is the bill that's coming out soon you might have this you might have a newer version if you're watching this video in the future so if you've got a build of Windows that's in the 1800 918 thousand nine hundred to plus range then you've probably got some pretty cool stuff that you may not have turned on yet a couple of things that we want to talk about first are WSL the windows subsystem for linux as well as how it works with docker and also vs code specifically the vs code remote extensions and then I want to talk about the Windows terminal these are the things that you need so a newish Windows 10 I say insiders fast windows subsystem for Linux turn it on docker get the tech preview the Visual Studio codes remote extension and the Windows terminal if you have those things you're in a really good place let's talk about that ok first thing I want to do is go to the Start menu and type features I'm gonna go here where it says turn Windows Features on and off at the very bottom of this here it says windows subsystem for Linux and the virtual machine platform now you can do that in this user interface if you want or you could go to the Windows Store just type in search and search for Linux it's just a regular old Windows Store I searched for Linux you can see here we've got run Linux on Windows lots of different Linux's lots and lots of free ones a couple that cost this one's really great penguin Linux I paid for this one it's actually a custom build of Linux just for the windows subsystem for Linux with a lot of really really great add-ons definitely worth the money you can grab boon 2 for free when you click on a boon - this is coming actually from the folks that made it boom - make sure that you click more you can see here there's a line in naval windows optional feature that's actually the PowerShell script that you would type at an administrative powershell that would turn this on it's the same thing as going into that dialog on Windows feature and clicking the check box that's the way to programmatically do that next thing I want you to do is search for the terminal in the Windows Store and look for the Windows terminal this is actually an open source terminal that's currently in preview and this is a just getting started I think they're on version zero point three or four but this is really great so if I launch the terminal I'm gonna go ahead and close that this is a replacement for what we think of as the cons or the dosbox if I type cmd.exe I get the the original DOSBox and I'm saying that in quotes if I type in PowerShell I get that as well if I type ubuntu that as well all of these are consoles that are hosted by a thing called con host that's a thing that's been in Windows for a very very long time I want to make sure that you understand that a console and a shell are different things this terminal is a new console with dropdowns it does cool animations and stuff if you want I can have a Visual Studio PowerShell you have a boon tool I can have an azure cloud shell I can hit settings and go into a JSON file that I can edit and that JSON file allows me to have whatever profiles make me happy so take a look at this I'm just going to open up my jason file I happen to use Visual Studio as my jason file editor so here I've gone and edited my profile to include lubuntu with the font that I want with the command line that allows me to use the windows subsystem for Linux now the windows subsystem for linux has a little executable that you can use to control it so if you go out to daus or powershell or whatever you type wsl - - list you can see here i've actually got three different linux's I can get to these three different linux's however I want I can run them by saying WS l - D I can say W Linux for example and now I'm in the penguin W Linux this one includes an X server so if I want to I can go and run X applications now if I hit exit I'm back out at the DOS prompt and I say Dawson quotes cuz it's not really Dossett in this case it's PowerShell I can say W is cell - Debian and now I'm in Debian very very fast WS l2 is really interesting because it's actually real Linux this is not any kind of emulated Linux actually using a tiny tiny tiny virtual machine you can actually go and see if I bring task manager over here VM managing about 500 Meg's of RAM it's a little tiny mini virtual machine it starts up like that two three four seconds tops cold and less than a second hot which is really really cool you notice also the directory on that right there is it mount see if I actually go to the mount point in my Linux and I say slash mount see my other drives as well so full access to my drives and then I've got my boon to Linux file system right here now if I want to I could go and you know it's apt-get whatever I have to get install node or Ruby or whatever makes me happy but I don't necessarily want to use vim if I want more power to you if you like them but I want to use something like Visual Studio code to do my my editing so what if I was gonna go and do something in node right do something a little bit different I'll say make directory hey node okay and let's go into that notice that this is in my lubuntu filesystem i've got nothing in there right now and I'm gonna type code now I have Visual Studio code installed when I hit code though I'm in Ubuntu watch this it launches Visual Studio code in Windows okay in the lower left corner here it says wsl Ubuntu it actually knows that I'm you know Boonta it was launched from abouttwo and if I go and say open folder something really interesting happens and this blurs the lines between Windows and Linux and why Windows 10 is such a compelling place to do development right now that slash home slash Scott is not see : user slash Scott which is my Windows home folder instead it's something else if I go down here and look at my network you see how I've got the different things in my in my house but if I come over here and I type in Explorer you know boon to now dot exe look what happens WSL Lubuntu there's my file systems are actually running a plan 9 Network server which allows me to have access to these files so let's go ahead and watch that I'm gonna just keep that over here off to the corner so I've got a boon to real a boon to I've got my application here that has not been created yet inside of Visual Studio code and I'm gonna just say file new file we'll just call it like server I will just save it I'll just I'm gonna drop in some node code and I'll hit save server dot j/s okay I'm gonna say a little JavaScript file there okay take a look at this over here there it is server that's yes it's in I'm looking at the Ubuntu file system over the network which isn't really a network though right because what we're doing here is we're talking all local wsl manages all of this and this is really really important because you want the best of both worlds you want the best of legs and the best of Windows Visual Studio code knows I'm talking to upin - okay so check this out I'm just gonna go ahead and hit f5 it says activating extension and says hey what are you doing what's going on here we're using node starts up running port 8000 let me know it open up edge now this is not the edge that is not any fun to run this is actually what I like to call edge iam this is the canary version of edge that is now using chromium at its heart and I'm going to type in localhost and what are we on here port 8000 like that there's the hello world of my node app running within the context of the windows subsystem for linux this is interesting because this is actually kind of a tiny virtual machine but nah it doesn't feel like a virtual machine it didn't take 15 minutes to load up I didn't have to think about I'd have to manage it I just typed Ubuntu or type bash and I get real Linux on real Windows when I said localhost though is it really local well turns up there they're handling that for us localhost port 8000 is actually brokering through kind of punching through in over to my windows subsystem of Linux I don't have to do anything I'm just set anything up it just works now I'm gonna go and just drop in a breakpoint hit refresh again again I'm in edge iam edge new edge I don't want to call it edge but Chrome I'm looking at my file system for Linux within Windows Explorer I'm now at a breakpoint inside of Visual Studio code on Windows but Linux is doing the work and again if you want to prove it you just type H top see what's going on and you can see look Visual Studio code server what's happening is part of Visual Studio code is running in Linux on wsl part of it I'm actually using control scroll on my mouse here so check this out list if you're going to look at something and really get it take the screenshot of that my friends check it out for panes pretty slick hello world breakpoint there's the work happening in H top in Ubuntu and there's the file on disk pretty fantastic this is just one example it could be Python it could be Ruby it could be whatever the other thing that's fun to point out by the way if I go ahead and maximize this I'll open up another tab for Ubuntu and I'll take docker images I currently don't have docker running but I'm gonna go and just bring up docker for Windows here and hit start this is the technical preview of docker everything I'm running is free and available to be downloaded so I just started up docker and now it looked docker you can now run docker from within windows RW so I say docker images look at that I've got docker here in Ubuntu real docker doing the real work now we can go and do maybe like a hello world image so I'll say docker run HelloWorld cool there's the hello world I can go back over into Windows say docker images see the same thing docker works there as well pretty slick so I could go and run docker do whatever makes me happy that is all the things that I wanted to show you today so we've had the Windows terminal we've got docker I've got remote development running on Windows using Ubuntu but of course I can have other Linux's if I want and I can use the new Windows terminal which is also open source you can check out all these things and more if you go up to my blog and check them out I've written about the new console every time I talk or desktop and wsl - all these things you can make happen on your Windows machine it's really a very lovely time to be a developer on Windows whether you're a Linux developer or a node or Python or Ruby or whatever makes you happy leave a comment if you have a cool tip or trick on how to be a great developer and maybe I'll do a video on it thanks so much
Info
Channel: Scott Hanselman
Views: 335,871
Rating: 4.9294548 out of 5
Keywords: linux, windows, wsl2, wsl, open source, tips, hanselman
Id: A0eqZujVfYU
Channel Id: undefined
Length: 14min 15sec (855 seconds)
Published: Thu Sep 12 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.