如何安装Docker Desktop
Docker Desktop 安装指南(Windows + macOS)
Section titled “Docker Desktop 安装指南(Windows + macOS)”一、系统要求(必看)
Section titled “一、系统要求(必看)”Windows 系统
Section titled “Windows 系统”- 系统版本:Windows 10 64位(21H2/19044+)、Windows 11 64位(所有版本)
- 硬件:64位处理器,开启CPU虚拟化(Intel VT-x / AMD-V)
- 必备组件:WSL 2(推荐)或 Hyper-V
macOS 系统
Section titled “macOS 系统”- 系统版本:macOS 10.15+(Catalina及以上)
- 芯片:Intel 或 Apple Silicon(M1/M2/M3)
二、Windows 安装步骤
Section titled “二、Windows 安装步骤”1. 下载安装包
Section titled “1. 下载安装包”访问 Docker 官网下载:
https://www.docker.com/products/docker-desktop/
下载文件:Docker Desktop Installer.exe
2. 安装配置
Section titled “2. 安装配置”- 双击运行安装包,以管理员身份运行更佳
- 勾选 Accept the terms,点击 Next
- 关键配置(推荐):
- ✅ Use WSL 2 instead of Hyper-V(性能更好)
- ✅ Create a desktop shortcut(创建桌面快捷方式)
- 点击 Install 开始安装
- 安装完成后,点击 Close and restart 重启电脑
3. 首次启动与验证
Section titled “3. 首次启动与验证”- 重启后,Docker Desktop 会自动启动
- 等待初始化完成(任务栏 Docker 图标变绿)
- 打开终端(CMD/PowerShell),执行验证命令:
Terminal window docker --versiondocker run hello-world - 出现
Hello from Docker!即安装成功
4. 命令行安装(可选)
Section titled “4. 命令行安装(可选)”# PowerShell(管理员)Start-Process 'Docker Desktop Installer.exe' -Wait install
# CMD(管理员)start /w "" "Docker Desktop Installer.exe" install三、macOS 安装步骤
Section titled “三、macOS 安装步骤”1. 下载安装包
Section titled “1. 下载安装包”访问 Docker 官网下载:
https://www.docker.com/products/docker-desktop/
下载文件:Docker.dmg
2. 安装配置
Section titled “2. 安装配置”- 双击
Docker.dmg打开镜像 - 将 Docker 图标拖入 Applications 文件夹
- 打开 Applications,双击 Docker.app 启动
- 首次启动时,若提示“无法打开”,前往:
- 系统设置 → 安全性与隐私 → 点击 仍要打开
3. 首次启动与验证
Section titled “3. 首次启动与验证”- 等待 Docker 启动完成(菜单栏出现 Docker 图标)
- 打开终端,执行验证命令:
Terminal window docker --versiondocker run hello-world - 出现
Hello from Docker!即安装成功
4. 命令行安装(可选)
Section titled “4. 命令行安装(可选)”sudo hdiutil attach Docker.dmgsudo /Volumes/Docker/Docker.app/Contents/MacOS/install --accept-licensesudo hdiutil detach /Volumes/Docker四、常见问题与解决
Section titled “四、常见问题与解决”1. Windows 虚拟化未开启
Section titled “1. Windows 虚拟化未开启”- 任务管理器 → 性能 → CPU → 查看“虚拟化”状态
- 若为“已禁用”,重启电脑进入 BIOS/UEFI 开启 Intel VT-x 或 AMD-V
2. WSL 2 需要更新
Section titled “2. WSL 2 需要更新”wsl --update更新后重启 Docker Desktop
3. macOS 提示“已损坏”
Section titled “3. macOS 提示“已损坏””- 系统设置 → 安全性与隐私 → 通用 → 点击 仍要打开
五、安装后配置(推荐)
Section titled “五、安装后配置(推荐)”1. 国内镜像加速(解决拉取镜像慢)
Section titled “1. 国内镜像加速(解决拉取镜像慢)”- 打开 Docker Desktop → 右上角 Settings(齿轮图标)
- 选择 Docker Engine
- 替换配置(示例):
{"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn","https://hub-mirror.c.163.com"],"features": {"buildkit": true}}
- 点击 Apply & Restart 保存并重启
2. WSL 2 集成(Windows)
Section titled “2. WSL 2 集成(Windows)”- Settings → Resources → WSL Integration
- 勾选需要集成的 Linux 发行版(如 Ubuntu)
- 点击 Apply & Restart
六、卸载方法
Section titled “六、卸载方法”Windows
Section titled “Windows”- 控制面板 → 程序 → 程序和功能
- 找到 Docker Desktop → 右键 → 卸载
- 打开 Docker Desktop → 右上角菜单 → Troubleshoot
- 点击 Uninstall
- 或直接将 Applications 中的 Docker.app 拖入废纸篓