当前位置: 首页 > article >正文

Win11配置wsl、ubuntu、docker

  • 系统要求

安装WSL。

开通虚拟化:

  • 准备工作
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

wsl --set-default-version 2
  • 安装WSL Ubuntu

方式1(推荐):在Store中搜索Ubuntu,直接安装一个指定版本。

方式2:打开PowerShell,执行命令手动安装:wsl --install

    • 开始菜单中,找到刚刚安装的Ubuntu,运行(有时第一次会报错,再点几次)

    查看:

     wsl -l -v
      NAME            STATE           VERSION
    * Ubuntu-22.04    Running         2
    • 安装docker

    Docker Desktop: The #1 Containerization Tool for Developers | Docker

    在安装界面,勾选 “Enable the WSL 2 based engine”

    • 检查docker设置

    启动 Docker Desktop,进入设置:

    General页面,确认已启用 WSL 2 引擎。

    Resources页面 > WSL Integration。勾选你的 Linux 发行版(例如 Ubuntu),启用与 Docker 的集成。

    点击Apply & restart。

    • 打开Ubuntu
    docker --version
    Docker version 27.4.0, build bde2b89

    测试docker

    $ docker run hello-world
    Unable to find image 'hello-world:latest' locally
    latest: Pulling from library/hello-world
    e6590344b1a5: Download complete
    Digest: sha256:e0b569a5163a5e6be84e210a2587e7d447e08f87a0e90798363fa44a0464a1e8
    Status: Downloaded newer image for hello-world:latest
    
    Hello from Docker!
    This message shows that your installation appears to be working correctly.
    
    To generate this message, Docker took the following steps:
     1. The Docker client contacted the Docker daemon.
     2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
        (amd64)
     3. The Docker daemon created a new container from that image which runs the
        executable that produces the output you are currently reading.
     4. The Docker daemon streamed that output to the Docker client, which sent it
        to your terminal.
    
    To try something more ambitious, you can run an Ubuntu container with:
     $ docker run -it ubuntu bash
    
    Share images, automate workflows, and more with a free Docker ID:
     https://hub.docker.com/
    
    For more examples and ideas, visit:
     https://docs.docker.com/get-started/
    • 允许非root用户运行docker
    sudo groupadd docker;
    sudo usermod -aG docker $USER

    http://www.kler.cn/a/548121.html

    相关文章:

  • Leetcode 394 字符串解码
  • DeepSeek崛起:中国AI产业的颠覆者与重构者
  • WEB安全--SQL注入--二次注入
  • haproxy详解笔记
  • 【第9章:计算机视觉实战—9.3 计算机视觉在医疗影像分析中的应用案例】
  • 机器学习实战(3):线性回归——预测连续变量
  • 恩智浦:将开发文档迁移到DITA/XML
  • AWS Fargate 部署流程图及说明
  • Visual Studio Code支持WSL,直接修改linux/ubuntu中的文件
  • unity 为什么保存场景时要求重新选择文件夹
  • Qt的QTreeWidget样式设置
  • C++ Primer 参数传递
  • Docker Desktop之Nginx
  • 机器学习数学基础:23.二次型及其标准形
  • 数据结构6
  • 如何让内网下其他主机直接通过 ip 访问docker overlay 网段下对应容器?
  • WRF与神经网络结合算法
  • 【Linux网络-网络基础】计算机网络背景+协议+OSI七层模型
  • 【机器学习】数据集合集!
  • React echarts柱状图点击某个柱子跳转页面