• 【WSL】安装WSL和Docker-20220828


    参考

    https://docs.microsoft.com/zh-cn/windows/wsl/install
    https://docs.microsoft.com/zh-cn/windows/wsl/setup/environment

    打开管理员 PowerShell输入此命令

    wsl --list --online
    wsl --install -d Ubuntu-20.04

    PS C:\WINDOWS\system32> wsl --list --online
    以下是可安装的有效分发的列表。
    请使用“wsl --install -d <分发>”安装。
    
    NAME            FRIENDLY NAME
    Ubuntu          Ubuntu
    Debian          Debian GNU/Linux
    kali-linux      Kali Linux Rolling
    openSUSE-42     openSUSE Leap 42
    SLES-12         SUSE Linux Enterprise Server v12
    Ubuntu-16.04    Ubuntu 16.04 LTS
    Ubuntu-18.04    Ubuntu 18.04 LTS
    Ubuntu-20.04    Ubuntu 20.04 LTS
    PS C:\WINDOWS\system32> wsl --install -d Ubuntu-20.04
    正在下载: Ubuntu 20.04 LTS
    正在安装: Ubuntu 20.04 LTS
    已安装 Ubuntu 20.04 LTS。
    正在启动 Ubuntu 20.04 LTS…
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18

    WSL自动启动

    输入账号和密码
    手动更新sudo apt update
    手动更新apt list --upgradable

    Installing, this may take a few minutes...
    Please create a default UNIX user account. The username does not need to match your Windows username.
    For more information visit: https://aka.ms/wslusers
    Enter new UNIX username: season
    New password:
    Retype new password:
    passwd: password updated successfully
    Installation successful!
    To run a command as administrator (user "root"), use "sudo ".
    See "man sudo_root" for details.
    
    Welcome to Ubuntu 20.04 LTS (GNU/Linux 4.4.0-19041-Microsoft x86_64)
    
     * Documentation:  https://help.ubuntu.com
     * Management:     https://landscape.canonical.com
     * Support:        https://ubuntu.com/advantage
    
      System information as of Sun Aug 28 12:03:17 CST 2022
    
      System load:    0.52      Processes:              7
      Usage of /home: unknown   Users logged in:        0
      Memory usage:   82%       IPv4 address for eth1:  172.21.16.1
      Swap usage:     1%        IPv4 address for wifi0: 192.168.31.237
    
    0 updates can be installed immediately.
    0 of these updates are security updates.
    
    
    The list of available updates is more than a week old.
    To check for new updates run: sudo apt update
    
    
    This message is shown once once a day. To disable it please create the
    /home/season/.hushlogin file.
    season@DESKTOP-25N1E20:~$ sudo apt update
    
    
    
    278 packages can be upgraded. Run 'apt list --upgradable' to see them.
    season@DESKTOP-25N1E20:~$ apt list --upgradable
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40

    检查正在运行的 WSL 版本

    wsl -l -v

    PS C:\WINDOWS\system32> wsl -l -v
      NAME                   STATE           VERSION
    * docker-desktop-data    Running         2
      docker-desktop         Running         2
      Ubuntu-20.04           Running         1
    
    • 1
    • 2
    • 3
    • 4
    • 5

    VS code打开WSL

    在这里插入图片描述
    WSL文件夹可以在windows中访问。
    在这里插入图片描述

    将WSL1升级到WSL2

    wsl --set-version Ubuntu-20.04 2

      Ubuntu-20.04           Running         1
    PS C:\WINDOWS\system32> wsl --set-version Ubuntu-20.04 2
    正在进行转换,这可能需要几分钟时间...
    有关与 WSL 2 的主要区别的信息,请访问 https://aka.ms/wsl2
    转换完成。
    PS C:\WINDOWS\system32> wsl -l -v
      NAME                   STATE           VERSION
    * docker-desktop-data    Running         2
      docker-desktop         Running         2
      Ubuntu-20.04           Stopped         2
    PS C:\WINDOWS\system32> wsl -l -v
      NAME                   STATE           VERSION
    * docker-desktop-data    Running         2
      docker-desktop         Running         2
      Ubuntu-20.04           Running         2
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    安装docker

    启动docker

    Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

    sudo service docker start
    
    • 1

    运行docker命令

    docker pull seasonzhang/gaga_meeting:0.9.1
    docker run --name gaga_meeting -p 8000:8000 seasonzhang/gaga_meeting:0.9.1
    
    • 1
    • 2

    成功进入django debug模式
    在这里插入图片描述

  • 相关阅读:
    js文字逐个显示
    cubemx工程更换同系列stm32芯片型号
    QGIS安装(以Windows系统为例)
    Spring Cloud Gateway网关两种负载均衡
    MySQL 高可用之MHA 工作原理和架构,实现MHA高可用实战案例
    SRM采购管理系统投标管理模块:阳光招采,助力建筑材料企业智慧采购
    2 万字 + 20张图|细说 Redis 九种数据类型和应用场景
    java线程池详解
    WPS—JS宏笔记记录
    Drools规则引擎入门学习记录
  • 原文地址:https://blog.csdn.net/m0_46629123/article/details/126568390