WSL 2 with Docker getting started

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
- In a previous video, which I've linked here and below, I showed you how to install WSL version two on a windows 10 laptop. I was actually using this laptop in the demonstration. In this video I'm gonna show you how to install Docker on a computer that's using WSL version two. (upbeat music) In this example I'm looking at the documentation on Docker's website. So docs.docker.com/docker-for-windows/wsl/ and we given information about how to use the Docker desktop with WSL version two. Now before you get started, they are some prerequisites. So number one, you need to install Windows 10 version 2004 or higher. So if I run winver, I can see that I'm using Microsoft Windows 10, 2004, OS build is this. Now I'm not using a professional version of Windows here. I'm simply using Windows Home Edition. You don't need the professional enterprise versions of Windows 10 to use Docker. You can run it on a Windows 10 Home computer. You can see that I've got 8 gig of Ram in this computer. It's a 64-bit operating system. So 64-bit version of Windows 10. So some people have been struggling to get version 2004. You have to do a manual install of 2004, but that is once again the required minimum, if you wanna install Docker on Windows 10. So hopefully Microsoft will resolve the issues, but you can manually bypass this and get it installed if you need to. Okay you need to enable WSL version two and we're told that we need to refer to the Microsoft documentation if we wanna do that. So they do have documentation showing you that, but the process is actually very simple so I'll show you this right now. Basically you need to turn on Windows features and the two features you need are the Windows Hypervisor Platform and the Windows Subsystem for Linux. So by checking those two check boxes, you basically enabled WSL version two. And the next thing you need to do is download and install the Linux kernel update package. I've once again demonstrated this in the previous video. So have a look at this video, if you haven't got WSL version two installed. So once you meet the prerequisites, next step is to download the Docker Desktop Stable release. So in this example, I'll download the release 232 and I'm simply gonna click, Get Docker, to download it to my local hard drive. It's about 391 mega in size, so just be aware of the size, but as soon as that's I'll run it. So it's busy downloading to my downloads directory. Okay so there you go, It's downloaded. I'll show in folder. And all I need to do now is double click on the executable to install it. Windows is complaining that I'm trying to install an app that isn't Microsoft verified. I'm gonna click install anyway. Click yes to allow the app to make changes to my device. I now need to specify the configuration. So I wanna enable WSL version two Windows features and I wanna add a shortcut to my desktop. Because I'm using Windows Home here the only option is to use WSL version two. Windows Home doesn't support Hyper-V. So I can't use Hyper-V. The only option is to use WSL version two. If you've got Windows Professional, you could decide to use Hyper-V view if you want to. But in this example, once again, cause I'm using Windows Home, I'm gonna use WSL version two, and I'm gonna click okay to install it. All you need to do basically now is wait for the software to install. Not much else to do. It takes a while to install. Okay so the installation has now succeeded. I'm gonna click close. You may be asked to log off and then log back into Windows, so it didn't happen this time, but I have seen that happen in previous installs, but once it's installed, you can simply start Docker Desktop. I can see that Linux Containers, WSL version two backend is starting. You can see the little Docker icon is displaying here telling me that Docker is starting. I'm told that the Docker Desktop is running, open PowerShell and start hacking with Docker or Compose or click on the up arrow, click on the icon, and what I'll do is display the dashboard. Okay so I'm told that no containers are running, try running a container by copying and pasting this command into your terminal and then come back. So what I'll do is start Ubuntu 2004 LTS. And before I do anything else, I'm gonna copy this command and I'm gonna save that command in notepad. I wanna show you what that command does. But before I run that, I'm gonna go to settings, resources, WSL integration and what you'll notice is we've got this option. Enable integration with my default WSL distro. So it's gonna be using the default WSL distro and you might not know which distro that is. So what I'll do is run PowerShell and use the command wsl -l -v. And that shows me that this is my default WSL implementation. The command wsl -l shows me that 2004 is my default distro. You can enable it on multiple distros. In this example, I've got three Linux distros installed using WSL version two, but it's using my default one. Under general notice this option, use the WSL 2 based engine. Windows Home can only run WSL version 2 backend. WSL version two provides better performance than the legacy Hype-V backend, and you can learn more about that. That basically just takes us back to the page that I started with. But basically here, they are showing you the commands that I used. You need to use WSL version 2 with Docker. So back in PowerShell as an example, you can see that all of my virtual machines are using WSL version two. If they're not, you can set the version to version two or set the default version using this command to version two. Okay but that's probably not what you wanna see. So in my Ubuntu 2004 Shell, so lsb release-a. You can see I'm using Ubuntu 2004, what I'm gonna do is copy this command that they gave us, and I'll paste that in, and I'll try and paste that in, there you go. So Docker run, Docker getting started. We can see that it's pulling they're getting started, Docker image and that's now running. So what I can do as an example is type docker run hello world, and I typed that wrong, so let me try that again. I'll make this bigger. Here is the command once again, I'm told that that image couldn't be found a locally. So a Docker pull was used. The Pull completed and it says, "Hello from Docker! This message shows you that your installation appears to be working correctly." So what I've done now is get Docker to run within an Ubuntu virtual machine, running on a Windows 10 the laptop using Windows Home. But let's try something more exciting. So let's run the command that they mentioned here. This will allow me to run an Ubuntu Container. So docker run -ubuntu bash. It's doing a pull and then downloading the operating system and what you'll notice here is the originally looked like that, but now it looks like this. I'm actually running Ubuntu within Docker, within Ubuntu, within windows on this laptop. So I'm running operating systems within other operating systems. So as an example, if I type lsb-release a, this command doesn't work, I could type uname -a and that tells me the version of Linux that I'm using. Notice what happens when I type exit, I'm exiting out of the Docker container and I'm now directly within my Ubuntu Virtual Machine running within WSL version two , so that command now works. And if I type exit here, I'm exiting out into Windows. So let me show you that process again. Here I have a Windows operating system running on a piece of hardware, this laptop here. What I'm gonna do is run Ubuntu 2004, so I'm now running Ubuntu within Windows. This is a lightweight virtual machine running within WSL version two on Windows 10, Home edition. Type docker run ubuntu bash. I'm now running a Ubuntu, within Docker, within a Linux Virtual Machine, within windows. Now once again, the lsb_release a command doesn't work in this Docker container. So I'll type apt update to update my references. This is within the Docker Container. So the operating system has now been updated, I'll clear the screen and type apt install lsb-release. Say yes to install the additional software. So what I'm doing now is installing additional software within the Docker Container. So this isn't Ubuntu Docker Container once again, say lsb-release-a, you can now see that this command is working. I'm using Ubuntu 2004 LTS. If I type exit, notice the prompt has changed from that to this. I'm no longer inside of the Docker Container. I'm now within the Linux Virtual Machine. And now if I type exit once again, I'm back in Windows. So this is the thing with virtualization. I can run operating systems, within operating systems, within operating systems. So again I had a Linux operating system running within Docker, which was running within a Linux Virtual Machine, running within WSL version two on a Windows operating system, running on a laptop. So I'm running operating systems, within operating systems, but that's how you get Docker running on a Windows 10 computer. (upbeat music)
Info
Channel: David Bombal
Views: 122,041
Rating: 4.9505992 out of 5
Keywords: WSL, docker, wsl docker, WSL 2, WSL2, Windows Subsystem for Linux 2, WSL1, WSL 1, Linux, Linux kernel, Microsoft, Ubuntu 20.04, Ubuntu, Windows on Arm, WSL2 on Arm, Python, Techn, Explanation, Tutorial, Windows 10, VS Code, wsl, how to install wsl 2, windows subsystem for linux, linux, windows 10, ubuntu, linux wsl 2, windows 10 wsl 2, powershell wsl 2, getting started wsl 2, set up wsl 2, setup wsl 2, upgrade to wsl 2, update to wsl 2
Id: 5RQbdMn04Oc
Channel Id: undefined
Length: 12min 11sec (731 seconds)
Published: Tue Jun 23 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.