当前位置:   article > 正文

wsl vscode Linux安装docker_wsl docker vscode

wsl docker vscode

Docker Desktop WSL 2 backend on Windows | Docker Documentation

Prerequisites

Before you turn on the Docker Desktop WSL 2, ensure you have:

Turn on Docker Desktop WSL 2

  1. Download Docker Desktop for Windows.
  2. Follow the usual installation instructions to install Docker Desktop. If you are running a supported system, Docker Desktop prompts you to enable WSL 2 during installation. Read the information displayed on the screen and enable WSL 2 to continue.
  3. Start Docker Desktop from the Windows Start menu.
  4. From the Docker menu, select Settings and then General.
  5. Select the Use WSL 2 based engine check box.

    If you have installed Docker Desktop on a system that supports WSL 2, this option is enabled by default.

  6. Select Apply & Restart.

Now docker commands work from Windows using the new WSL 2 engine.

Enabling Docker support in WSL 2 distros

WSL 2 adds support for “Linux distros” to Windows, where each distro behaves like a VM except they all run on top of a single shared Linux kernel.

Docker Desktop does not require any particular Linux distros to be installed. The docker CLI and UI all work fine from Windows without any additional Linux distros. However for the best developer experience, we recommend installing at least one additional distro and enabling Docker support by:

  1. Ensure the distribution runs in WSL 2 mode. WSL can run distributions in both v1 or v2 mode.

    To check the WSL mode, run:

      $ wsl.exe -l -v
    

    To upgrade your existing Linux distro to v2, run:

     $ wsl.exe --set-version (distro name) 2
    

    To set v2 as the default version for future installations, run:

     $ wsl.exe --set-default-version 2
    
  2. When Docker Desktop starts, go to Settings > Resources > WSL Integration.

    The Docker-WSL integration is enabled on your default WSL distribution. To change your default WSL distro, run wsl --set-default <distro name>

    For example, to set Ubuntu as your default WSL distro, run:

     $ wsl --set-default ubuntu
    

    Optionally, select any additional distributions you would like to enable the Docker-WSL integration on.

    Note

    The Docker-WSL integration components running in your distro depend on glibc. This can cause issues when running musl-based distros such as Alpine Linux. Alpine users can use the alpine-pkg-glibc package to deploy glibc alongside musl to run the integration.

  3. Select Apply & Restart.

Note

Docker Desktop installs two special-purpose internal Linux distros docker-desktop and docker-desktop-data. The first (docker-desktop) is used to run the Docker engine (dockerd) while the second (docker-desktop-data) stores containers and images. Neither can be used for general development.

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/895102
推荐阅读
相关标签
  

闽ICP备14008679号