Tag: Linux Container

Docker Desktop WSL 2 Tech Preview

Run Linux Containers with Docker Desktop and WSL 2

Today, Docker launched the first Tech Preview of the Docker Desktop WSL 2. This means you can now use Docker Desktop and the Windows Subsystem for Linux 2 (WSL2) which is using the hypervisor in the background to run Linux containers on Windows 10. With the significant changes to the Windows Subsystem for Linux 2, you can now take advantage of these improvements with your Docker Desktop client.

Docker Desktop WSL 2 is currently in Tech Preview, and it also requires the Windows 10 Insider Preview builds. That means you should only use for not production environments.

WSL 2 introduces a significant architectural change as it is a full Linux kernel built by Microsoft, allowing Linux containers to run natively without emulation. With Docker Desktop WSL 2 Tech Preview, users can access Linux workspaces without having to maintain both Linux and Windows build scripts.

Docker Desktop also leverages the dynamic memory allocation feature in WSL 2 to greatly improve the resource consumption. This means, Docker Desktop only uses the required amount of CPU and memory resources, enabling CPU and memory-intensive tasks such as building a container to run much faster.

You can find more information about the Tech Preview here.

Prerequisites

To run the Docker Desktop WSL 2 Tech Preview, you will need to set up the Windows Subsystem for Linux 2 (WSL 2) first. You can do that using the following guide, or follow these steps:

Install Windows 10 Insider Preview build 18932 or later.

Install the Windows WSL feature and the Windows Virtual Machine Platform feature running the following commands:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
 
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

Download WSL Linux distribution based on Ubuntu 18.04 from the Microsoft Store. You can read more about Linux on Windows 10 here. The distribution needs to be set as the default WSL distro.

Enable Virtual Machine Platform

Enable Virtual Machine Platform

Make sure that the WSL distro is running in WSL 2 mode. You can check the list of distros installed on your Windows 10 machine, with the following PowerShell command:

wsl -l -v

To set the distro to WSL 2, you can run the following command. Change the name of the distro:

wsl --set-version DistroName 2
Install WSL 2

Install WSL 2

To find out more about installing WSL 2, check out the Microsoft Docs page.

How to set up Docker and WSL 2

First, you will need to download the Docker Desktop WSL 2 Tech Preview here. Make sure you already configured all the WSL 2 steps described in the prerequisites, before you install the Docker WSL 2 Tech preview. If you are prompted if you want to use Linux containers or Windows containers during the installation, select Windows containers. If you choose Linux containers, you will have the classic Docker experience with a Hyper-V VM.

Docker Desktop WSL 2 Tech Preview Menu

Docker Desktop WSL 2 Tech Preview Menu

Run the installation wizard, and after a successful installation, the Docker Desktop menu displays the WSL 2 Tech Preview option. You can select WSL 2 Tech Preview from that menu to start and configure the daemon running WSL 2.

Docker Desktop WSL 2 Tech Preview

Docker Desktop WSL 2 Tech Preview

You can switch between the classic daemon or the Windows Subsystem for Linux 2 with the following commands:

# Switch to classic deamon
 
docker context use default
 
# Switch to WSL 2
 
docker context use wsl
Linux Container on Windows 10

Linux Containers on Windows 10

You can now also do crazy things like run SQL Server on Linux in a Docker container on Windows 10.

SQL Server on Linux Docker Container Windows 10 WSL 2

SQL Server on Linux Docker Container Windows 10 WSL 2

I hope this gives you a good overview of how you will be able to run Linux containers on Windows in the future. Again this is still a Tech Preview, and we might see many changes to that feature. If you want to know more, read the full blog post on the Docker page. Also, check out the current Linux Container on Windows documentation. If you any questions, feel free to leave a comment.



Docker for Windows Update Linux Containers

How to run Docker Linux Container on Windows 10 Fall Creator Update

I just blogged about how to run a Docker Linux Container natively on the new Windows Server version 1709. Docker today released a new update for Docker on Windows which also enables this scenario a little bit easier on your Windows 10 machine. It will ask you if you want to use the new feature to run Linux Containers natively on a Hyper-V Container running on Windows 10 (without the Moby VM).

As you can see the only thing right now you have to turn the feature on and off, since in this technical preview it is not yet possible to run Linux and Windows containers in parallel. But I guess soon that will be the case.

What you need is:

  • Windows 10 Fall Creators Update (Build 16299, Version 1709, RS3)
  • Docker for Windows 17.10.0-ce-win36 (13788) or higher

Enable Linux Containers on Windows

You can change the settings in the Docker Settings:

Docker for Windows Settings Enable Linux contianers on Windows

With hat setting on you can now run Linux Containers such as ubuntu on Windows directly, without having a Linux Virutal Machine running in the background to host the Linux containers.

Docker Run Ubuntu on Windows 10 Verions

Now you can also do some other fancy things like run the Azure CLI in a Linux Container on Windows 10.

Docker Azure CLI on Linux on Windows 10 Container

Simple and effective, and it will be even more powerful when you can run Linux and Windows Container in parallel on Windows Sever and on Windows 10.



Hyper-V Windows Containers

Windows Server news from Microsoft Build 2017 – It is all about Container!

Microsoft is just running their annual Developer Conference call Build with some interesting news for developers on Azure, Database Servers, Visual Studio, PowerShell, .NET and much more. But Microsoft also had some interesting things to share about the future of Windows Server. In a blog post, Erin Chapple, General Manager Windows Server, shared some information what Microsoft is doing in the Windows server space and about the next first feature release which will be aligned with the Windows 10 Client Operating System and will be released this Fall.

Windows Server is joining the Windows Insider program – Microsoft will start releasing regular Windows Server Insider builds including container images, which will be available to all Windows Insiders.

Container-optimized Nano Server – The Windows Server team has closely partnered with he .NET Team to bring the .NET Core 2.0 work to Windows Containers with an optimized container image based on Nano Server. This will reduce the footprint of the .NET container image by 50 percent, which will also reduce startup time as well as density improvements.

Windows Subsystem for Linux (WSL) on Windows Server – At DockerCon Keynote we demonstrated a Linux container running natively on Windows Server. To enable this, the Windows Server team worked to bring the Windows Subsystem for Linux (WSL), also know as bash on Windows 10, to Windows Server. Together with Hyper-V isolation technology, the WSL will allow users to run Linux Containers on a Windows Server Container Host. The great thing here, there is also a choice on the Linux kernel, which will allow you to run different Linux distributions as containers.

Container Orchestration – Microsoft works with different container orchestration technologies, such as Docker swarm and Kubernetes to bring support for Windows Server Containers.

Container Storage – In Windows Containers you could use locally mounted volumes to store persistent data. As another investment in Containers, Microsoft is adding the ability to map SMB file-based storage directly into a container.

Starting this summer, Microsoft will begin to post early builds of the new Windows Server features, including container-optimized Nano Server images to the Docker Hub, support for Linux containers, Windows Subsystem for Linux (WSL), better orchestration support and SMB storage for containers in the Windows Insider program.

Aligned with the next release of Windows 10, these new features will be delivered as part of our first feature release this Fall. It will be available to customers with Software Assurance who commit to a more frequent release model. For customers who prefer the long-term servicing branch (LTSB) these features will be part of the next major release of Windows Server.