Windows 11 安装 Docker Desktop

简介: WSL 全称是,适用于 Linux 的 Windows 子系统,可让开发人员按原样运行GNU/Linux 环境,包括大多数命令行工具、实用工具和应用程序,且不会产生传统虚拟机或双启动设置开销。简单的说就是WSL能让你在不安装 Linux 或者 VM(虚拟机)的情况下体验双系统!关于 WSL 更多信息,请查看

Windows 环境安装 WSL2

WSL 简介

WSL 全称是 Windows Subsystem for Linux ,适用于 LinuxWindows 子系统,可让开发人员按原样运行 GNU/Linux 环境,包括大多数命令行工具、实用工具和应用程序,且不会产生传统虚拟机或双启动设置开销。

简单的说就是 WSL 能让你在不安装 Linux 或者 VM(虚拟机)的情况下体验双系统!

关于 WSL 更多信息,请查看 => https://learn.microsoft.com/zh-cn/windows/wsl/about
比较 WSL 版本,请查看 => https://learn.microsoft.com/zh-cn/windows/wsl/compare-versions

Windows 系统配置要求:

  • 对于 x64 系统:版本 1903 或更高版本,内部版本为 18362 或更高版本。
  • 对于 ARM64 系统:版本 2004 或更高版本,内部版本为 19041 或更高版本。
例如: Windows 10 May 2020(2004)Windows 10 May 2019(1903)Windows 10 November 2019(1909)Windows 11
注意:低于 18362 的版本不支持 WSL 2。 使用 Windows Update 助手更新 Windows 版本。

Windows Update 助手 下载地址,https://www.microsoft.com/zh-cn/software-download/windows10

  • 具有 Hyper-V 虚拟化技术支持的计算机;

关于虚拟化技术说明:

虚拟化技术(Virtualization Technology,简称 VT),这种技术简单来说就是让可以让一个 CPU 工作起来就像多个 CPU 并行运行,从而使得在一台电脑内可以同时运行多个 OS 操作系统。

英特尔(Intel)AMD 的大部分 CPU 均支持 VT 技术:

  • 特尔(Intel) 名称为 VT-x
  • AMD 名称为 AMD-V

VT 开启之后对 VM 的性能有较大的提高。(比如:VMware、Hyper、安卓模拟器 等)

参考: https://zhuanlan.zhihu.com/p/394990397

检查 Windows 版信息

检查 Windows 版本及内部版本号,选择【Windows 徽标键 + R】,然后键入“winver”,选择【确定】。

winver

Windwos 安装 WSL2

说明:以下操作均以【管理员】身份打开 Windows PowerShellWindows Terminal,输入指令执行。

此处以 Windows Terminal 为例,操作步骤如下:

1、启用 WSL

不管您想要使用哪个版本的 WSL,都首先需要启用它。Windows Terminal输入命令:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

2、启用 “虚拟机平台”

WSL2 需要启用 Windows 10 的 “虚拟机平台” 特性。它独立于 Hyper-V,并提供了一些在 LinuxWindows 子系统新版本中可用的更有趣的平台集成。

  • Windows 10(2004) 上启用虚拟机平台:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  • Windows 10(1903,1909) 上启用虚拟机平台:
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -NoRestart
说明:此步骤为了确保所有相关部件配置生效,您应该在此时重启系统,否则可能会发不符合预期的情况。

3、设置 WSL2 为默认值

Windows Terminal 输入以下命令,将 WSL2 设置为 WSL 的默认版本:

wsl --set-default-version 2

4、安装一个 Linux 发行版

有了 WSL必要的虚拟化技术,接下来去 Microsoft Store 下载并安装 Linux 发行版,这里以 Ubuntu 22.04.2 LTS 为例。

注意:去商店( Microsoft Store)安装的 Linux 发行版只能安装在 C 盘。
  • 4.1 Microsoft Store 搜索 linux,选择 Ubuntu 22.04.2 LTS

Microsoft Store 搜索 linux

  • 4.2 Ubuntu 22.04.2 LTS 详情:

ubuntu 详情

  • 4.3 点击【安装】按钮,等待安装完成。

安装 ubuntu

  • 4.4 安装完以后在 Windows Terminal 中点开 Ubuntu,按照提示初次设置用户名和密码,注意用户名不支持大写。

ubuntu 安装完成

  • 4.5 使用 WSL2

最后显示 Installation successful! 就说明安装成功!整个过程挺简单的,毕竟是 WSL(Windows 的子系统),对 Windows 用户很友好。

Windows 环境安装 Docker Desktop

下载 Docker Desktop

注意选择 OS 平台下载相应的 Docker Desktop(下载地址 => https://docs.docker.com/desktop/),下载后以【管理员】身份运行 Docker Desktop 执行安装操作。

下载 docker

安装 Docker Desktop

Docker Desktop 安装好后,启动运行:

docker start

配置 Docker Desktop

  • 点击设置【Settings】

General

  • 选择【Docker Engine】添加如下配置:

Docker Engine

json 配置信息如下:

{
  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "dns": [
    "8.8.8.8",
    "8.8.4.4"
  ],
  "experimental": false,
  "features": {
    "buildkit": true
  },
  "insecure-registries": [
    "https://hub.atguigu.com"
  ],
  "registry-mirrors": [
    "https://registry.docker-cn.com",
    "http://hub-mirror.c.163.com",
    "https://mirror.ccs.tencentyun.com",
    "https://docker.mirrors.ustc.edu.cn",
    "https://cr.console.aliyun.com/"
  ]
}

添加配置后,点击左下角的【Apply & restart】按钮,等待配置生效并重启完成。

Docker Engine2

终端命令验证 Dcoker 是否安装成功

接下来我们打开 Windows Terminal,输入命令:

docker version

输出如下信息:

Client:
 Cloud integration: v1.0.29
 Version:           20.10.22
 API version:       1.41
 Go version:        go1.18.9
 Git commit:        3a2c30b
 Built:             Thu Dec 15 22:36:18 2022
 OS/Arch:           windows/amd64
 Context:           default
 Experimental:      true

Server: Docker Desktop 4.16.3 (96739)
 Engine:
  Version:          20.10.22
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.9
  Git commit:       42c8b31
  Built:            Thu Dec 15 22:26:14 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.14
  GitCommit:        9ba4b250366a5ddde94bb7c9d1def331423aa323
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

或者输入命令:

docker info

输出如下信息:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.10.0)
  compose: Docker Compose (Docker Inc., v2.15.1)
  dev: Docker Dev Environments (Docker Inc., v0.0.5)
  extension: Manages Docker extensions (Docker Inc., v0.2.17)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.23.0)

Server:
 Containers: 7
  Running: 3
  Paused: 0
  Stopped: 4
 Images: 30
 Server Version: 20.10.22
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 9ba4b250366a5ddde94bb7c9d1def331423aa323
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.10.16.3-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 13.59GiB
 Name: docker-desktop
 ID: SRPD:RTAI:YAGO:44HL:DPFW:KUPZ:RPYW:OX3X:VBZP:24GQ:YFVN:NPLX
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5000
  hub.atguigu.com
  127.0.0.0/8
 Registry Mirrors:
  https://registry.docker-cn.com/
  http://hub-mirror.c.163.com/
  https://mirror.ccs.tencentyun.com/
  https://docker.mirrors.ustc.edu.cn/
  https://cr.console.aliyun.com/
 Live Restore Enabled: false

看到上面输出的信息,说明 Windows 环境的 Docker Desktop 就安装完成了,此处是使用 WSL2 安装的 linux 发行版,我们可以 linux 原生环境体验 Docker 的相关操作。

目录
相关文章
|
1月前
|
Ubuntu Unix Linux
在Windows上轻松安装和使用Ubuntu的方法详解
继续点击“Continue”按钮以继续安装流程,随后选择清理磁盘并安装操作系统的选项。 接下来,在安装过程中,你需要选择时区。为了与你的地理位置相匹配,请选择中国上海作为你的时区设置。 在安装过程中,你还需要设置计算机的名称以及账号密码。请务必牢记这些信息,因为它们将作为你登录系统的凭证。
|
1月前
|
Ubuntu Linux 数据安全/隐私保护
Windows上快速安装Linux子系统Ubuntu
Installing, this may take a few minutes...WslRegisterDistribution failed with error: 0x800701bcError: 0x800701bc WSL 2 ?????????????????? https://aka.ms/wsl2kernelPress any key to continue... 原因是 wsl1 升级到 wsl2 之后,内核却没有升级。 解决:下载最新的wsl安装包(wsl安装包)
|
2月前
|
运维 Linux 虚拟化
VMware虚拟机安装教程,Windows下安装VMware虚拟机,附VMware下载,Windows各版本系统镜像下载
虚拟机技术允许一台物理机运行多个操作系统,提升资源利用率,节省成本。通过快照、克隆等功能,实现系统快速恢复与复制,提高运维效率。本文详细介绍VMware虚拟机的安装步骤、Windows镜像下载及系统安装激活流程,适合初学者快速入门。
748 0
|
2月前
|
Linux Docker Windows
windows docker安装报错适用于 Linux 的 Windows 子系统必须更新到最新版本才能继续。可通过运行 “wsl.exe --update” 进行更新。
适用于 Linux 的 Windows 子系统需更新至最新版本(如 wsl.2.4.11.0.x64.msi)以解决 2025 年 Windows 更新后可能出现的兼容性问题。用户可通过运行 “wsl.exe --update” 或访问提供的链接下载升级包进行更新。
728 0
|
机器学习/深度学习 安全 网络协议
达梦 DM8 数据库安装详细手册(Windows+Linux+Docker)(一)
达梦 DM8 数据库安装详细手册(Windows+Linux+Docker)(一)
达梦 DM8 数据库安装详细手册(Windows+Linux+Docker)(一)
|
安全 测试技术 数据库
达梦 DM8 数据库安装详细手册(Windows+Linux+Docker)(二)
达梦 DM8 数据库安装详细手册(Windows+Linux+Docker)(二)
达梦 DM8 数据库安装详细手册(Windows+Linux+Docker)(二)
|
NoSQL 数据可视化 Linux
Redis安装大全涵盖Windows Linux Docker(2)
Redis安装大全涵盖Windows Linux Docker
168 0
Redis安装大全涵盖Windows Linux Docker(2)