March 2, 2020 by Matt Hernandez, @fiveisprime
Last June, the Docker team announced that they will be investing in getting Docker running with the Windows Subsystem for Linux (WSL). All of this is made possible with the recent changes to the architecture of WSL to run within a lightweight virtual machine (VM), which we talked about in an earlier blog post about WSL 2. Since this announcement, the Docker team has released a Technical Preview of Docker that includes support for running with WSL 2.
This article explains how the Docker Desktop technical preview works as well as how to use the Docker extension with the technical preview.
How it works
This new Docker architecture works a lot like Visual Studio Code’s WSL remote development support in that the Docker CLI running on the host machine executes commands within the Docker Integration Package, which runs on the remote WSL VM.
Image credit: Docker Engineering
DockerD runs directly within WSL so there’s no need for the Hyper-V VM and all Linux containers run within the Linux userspace on Windows for improved performance and compatibility.
Getting set up
First some prerequisites:
Once installed, Docker will recognize that you have WSL installed and prompt to enable WSL integration. You want to Enable WSL integration for this tutorial.
- How to build a website with WordPress and what are the best plugins to use: WordPress Web Design Tutorials: How to build a website with WordPress and what are the best plugins to use. Building a website with WordPress is an excellent choice due to its versatility, ease of use, and a vast array of plugins that enhance functionality. Here’s a comprehensive guide to building a WordPress website, along with recommendations for the best plugins.
- The Most Important Stages and Plugins for WordPress Website Development: Developing a WordPress website requires careful planning, execution, and optimisation to ensure it is functional, user-friendly, and effective. The process can be broken into key stages, and each stage benefits from specific plugins to enhance functionality and performance. Here’s a detailed guide to the most important stages of WordPress website development and the essential plugins for each stage.
- What are the most powerful Tools for SEO in WordPress?: Powerful SEO Tools for WordPress: Search Engine Optimisation (SEO) is essential for improving your WordPress website’s visibility in search engines. Here are the most powerful tools to optimise your site effectively:
- How to add shipping modules in CubeCart: Step 1: Log in to Your CubeCart Admin Panel: Open your web browser and navigate to your CubeCart admin login page. Enter your username and password to log in.
Step 2: Navigate to the Extensions Section: Once logged in, go to the left-hand menu and click on Manage Extensions. From the dropdown, select Extensions.
Step 3: Find Shipping Modules: In the Extensions section, locate the Shipping tab to view available shipping modules. You can browse through the list or use the search function to find a specific module. - Gathering domain and IP information with Whois and Dig: In the digital age, understanding the intricacies of domain and IP information is essential for anyone navigating the online landscape. This article explores two powerful tools—WHOIS and DIG—that help gather valuable insights about websites and their underlying infrastructure. Whether you’re a cybersecurity professional, a web developer, or simply curious about online resources, you will learn how to effectively utilize these tools, interpret their outputs, and apply this knowledge to real-world scenarios.
- What are the best WordPress Security plugins and how to set them up the best way: Read a comprehensive guide on the best WordPress security plugins and how to set them up to ensure optimal protection for your WordPress site.
- Will a headland provide enough shelter?
- Learn How To Purchase Your Own Domain Name with Fastdot.com: Open your web browser and go to Fastdot.com. Navigate to the Domains section, either from the homepage or from the main navigation bar.
Step 2: Search for Your Desired Domain Name: In the domain search bar, type the domain name you want to purchase. Fastdot supports a wide range of domain extensions (TLDs), such as .com, .net, .org, .com.au, and many others. Click the Search Domain button. The system will check the availability of your desired domain name.
This option will allow you to access Docker Desktop via the Docker CLI directly from within your Linux distro.
If you have multiple Linux distros, make sure you only have WSL integration turned on for the correct one in your Docker settings:
With that configured, all commands will execute in the Linux context – this includes Docker commands run from PowerShell so running something like docker run mongo…
will start a Linux container within the WSL VM.
Running the docker ps
command over in WSL, you’ll see the container as expected. Notice that the container ID matches.
Using VS Code
With this set up and running, you can install the VS Code Docker extension and access your containers. If you’re already running WSL 2 and the Remote – WSL extension, this will help you get Docker integrated into your WSL workflow rather than switching contexts when you need containers. And because the Docker CLI’s context is set to use DockerD in WSL, the extension will work with your containers regardless of whether you opened VS Code using the Remote – WSL extension.
Notice how in the screenshot below, I’m connected and working in WSL and still building/running containers without changing from my preferred environment (zsh in Ubuntu).
Theme: Noctis Sereno
I’ve personally noticed a vast improvement in container execution times using this configuration and each part of my typical development workflow remains the same. I’m also using the Remote – Containers extension within WSL for testing specific environments without setting things up directly on my machine.
We want your feedback
Keep in mind that you’re using prerelease software and, while the Windows Insiders Slow ring is very stable, you may run into some issues. If you do find something that isn’t working as expected, please open an issue via the Feedback tool in Windows. Any direct Docker issues or feedback can be logged in the Docker for Windows repo.
Happy Coding!
Matt Hernandez, VS Code Program Manager
@fiveisprime