演示使用 docker 版本:4.27.2
操作系统版本:Windows 11 家庭中文版 23H2 22631.3296
Windows 平台使用 PowerShell 7.2.5 安装 Docker Desktop on Windows,指定安装路径,比如 install --installation-dir=D:\software\Docker
。如果你下载完,双击安装,默认安装路径为C:\Program Files\Docker\Docker
。
如果遇到 Start-Process: A positional parameter cannot be found that accepts argument '--installation-dir=D:\software\Docker'.
。
请尝试使用 Start-Process '.\Docker Desktop Installer.exe' 'install --installation-dir=D:\software\Docker'
做一个简单说明,在 Powershell 中使用某些命令指定参数,可能需要使用单引号或者双引号将指定参数拼接包裹起来,让系统将该命令识别为一个整体。
友情提醒:我这边安装测试环境默认采用 WSL2,你也可以使用 Hyper-V。
PowerShell 命令安装 docker
执行安装命令时,请切换到你下载 docker 所在路径执行命令。
PowerShell 7.2.5 安装 Docker Desktop on Windows,指定安装路径 install --installation-dir=D:\software\Docker
:
1
| Start-Process '.\Docker Desktop Installer.exe' 'install --installation-dir=D:\software\Docker'
|
PowerShell 7.2.5 安装 Docker 信息日志:
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 41 42 43 44 45
| PS E:\Downloads\Dev-tools\podman-docker> Start-Process '.\Docker Desktop Installer.exe' 'install --installation-dir=D:\software\Docker' PS E:\Downloads\Dev-tools\podman-docker> -------------------------------------------------------------------------------->8 Version: 4.27.2 (137060) Sha1: Started on: 2024-03-13 02:37:03.038 Resources: E:\Downloads\Dev-tools\podman-docker\resources OS: Windows 10 Home China Edition: CoreCountrySpecific Id: 2009 Build: 22631 BuildLabName: 22621.1.amd64fre.ni_release.220506-1250 File: C:\ProgramData\DockerDesktop\install-log-admin.txt CommandLine: "E:\Downloads\Dev-tools\podman-docker\Docker Desktop Installer.exe" install --installation-dir=D:\software\Docker You can send feedback, including this log file, at https://github.com/docker/for-win/issues [2024-03-13T02:37:03.207865500Z][ManifestAndExistingInstallationLoader][I] Install path is D:\software\Docker. Loading manifest first [2024-03-13T02:37:03.214865600Z][ManifestAndExistingInstallationLoader][I] No manifest found, returning no existing install [2024-03-13T02:37:03.214865600Z][Installer][I] No installation found [2024-03-13T02:37:03.437269300Z][InstallWorkflow][I] Cancel pending background download [2024-03-13T02:37:03.440268600Z][BackgroundTransfer][I] Cancel current background transfer job [2024-03-13T02:37:07.684391600Z][InstallWorkflow][I] Using package: res:DockerDesktop [2024-03-13T02:37:07.685763700Z][InstallWorkflow][I] Downloading [2024-03-13T02:37:08.963591300Z][InstallWorkflow][I] Extracting manifest [2024-03-13T02:37:09.632584000Z][InstallWorkflow][I] Manifest found: version=137060, displayVersion=4.27.2, channelUrl=https://desktop-stage.docker.com/win/main/amd64/appcast.xml [2024-03-13T02:37:09.632584000Z][InstallWorkflow][I] Checking prerequisites [2024-03-13T02:37:09.946644600Z][InstallWorkflow][I] Prompting for optional features [2024-03-13T02:37:36.239911500Z][InstallWorkflow][I] Selected backend mode: wsl-2 [2024-03-13T02:37:36.241400800Z][InstallWorkflow][I] Unpacking artifacts [2024-03-13T02:39:26.623864500Z][InstallWorkflow][I] Deploying component Docker.Installer.CreateGroupAction [2024-03-13T02:39:40.326128200Z][InstallWorkflow][I] Deploying component Docker.Installer.AddToGroupAction [2024-03-13T02:39:49.434171400Z][InstallWorkflow][I] Deploying component Docker.Installer.EnableFeaturesAction [2024-03-13T02:39:49.451171500Z][InstallWorkflow-EnableFeaturesAction][I] Required features: VirtualMachinePlatform, Microsoft-Windows-Subsystem-Linux [2024-03-13T02:39:50.034773100Z][InstallWorkflow][I] Deploying component Docker.Installer.ServiceAction [2024-03-13T02:39:50.036773000Z][InstallWorkflow-ServiceAction][I] Removing service [2024-03-13T02:39:50.038772900Z][InstallWorkflow-ServiceAction][I] Creating service [2024-03-13T02:39:50.041394600Z][InstallWorkflow][I] Deploying component Docker.Installer.ShortcutAction [2024-03-13T02:39:50.060434100Z][InstallWorkflow-ShortcutAction][I] Creating shortcut: C:\ProgramData\Microsoft\Windows\Start Menu\Docker Desktop.lnk/Docker Desktop [2024-03-13T02:39:50.067435200Z][InstallWorkflow][I] Deploying component Docker.Installer.ShortcutAction [2024-03-13T02:39:50.069434700Z][InstallWorkflow-ShortcutAction][I] Creating shortcut: C:\Users\kart\Desktop\Docker Desktop.lnk/Docker Desktop [2024-03-13T02:39:50.071434500Z][InstallWorkflow][I] Deploying component Docker.Installer.AutoStartAction [2024-03-13T02:39:50.072434700Z][InstallWorkflow][I] Deploying component Docker.Installer.PathAction [2024-03-13T02:39:50.376848700Z][InstallWorkflow][I] Deploying component Docker.Installer.ExecAction [2024-03-13T02:39:50.381848800Z][InstallWorkflow-ExecAction][I] Running: D:\software\Docker\InstallerCli.exe -i with timeout=-1 [2024-03-13T02:39:53.011361600Z][InstallWorkflow][I] Registering product [2024-03-13T02:39:53.024361600Z][InstallWorkflow][I] Deleting C:\ProgramData\DockerDesktop\install-settings.json [2024-03-13T02:39:53.027361700Z][InstallWorkflow][I] Installation succeeded
|
当你看到 Installation succeeded
,表示已经安装完成。
CMD 命令安装 docker
没有指定安装路径,默认安装路径为C:\Program Files\Docker\Docker
1
| start /w "" "Docker Desktop Installer.exe" install
|
指定安装路径,示例使用参数--installation-dir=<path>
1
| start /w "" "Docker Desktop Installer.exe" install --installation-dir=<path>
|
将 <path>
替换成所需要安装的路径,比如D:\software\Docker
。
演示我的安装路径,指定--installation-dir=D:\software\Docker
。执行安装命令时,请切换到你下载docker所在路径执行命令。
1
| e:\Downloads\Dev-tools\podman-docker>start /w "" "Docker Desktop Installer.exe" install --installation-dir=D:\software\Docker
|
CMD 命令安装 Docker 信息日志:
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 41 42 43 44 45
| e:\Downloads\Dev-tools\podman-docker>start /w "" "Docker Desktop Installer.exe" install --installation-dir=D:\software\Docker -------------------------------------------------------------------------------->8 Version: 4.27.2 (137060) Sha1: Started on: 2024-03-13 03:54:47.600 Resources: e:\Downloads\Dev-tools\podman-docker\resources OS: Windows 10 Home China Edition: CoreCountrySpecific Id: 2009 Build: 22631 BuildLabName: 22621.1.amd64fre.ni_release.220506-1250 File: C:\ProgramData\DockerDesktop\install-log-admin.txt CommandLine: "Docker Desktop Installer.exe" install --installation-dir=D:\software\Docker You can send feedback, including this log file, at https://github.com/docker/for-win/issues [2024-03-13T03:54:47.772593000Z][ManifestAndExistingInstallationLoader][I] Install path is D:\software\Docker. Loading manifest first [2024-03-13T03:54:47.781274400Z][ManifestAndExistingInstallationLoader][I] No manifest found, returning no existing install [2024-03-13T03:54:47.781274400Z][Installer][I] No installation found [2024-03-13T03:54:48.006629000Z][InstallWorkflow][I] Cancel pending background download [2024-03-13T03:54:48.010068800Z][BackgroundTransfer][I] Cancel current background transfer job [2024-03-13T03:54:52.222204900Z][InstallWorkflow][I] Using package: res:DockerDesktop [2024-03-13T03:54:52.224360200Z][InstallWorkflow][I] Downloading [2024-03-13T03:54:54.079911500Z][InstallWorkflow][I] Extracting manifest [2024-03-13T03:54:54.982972600Z][InstallWorkflow][I] Manifest found: version=137060, displayVersion=4.27.2, channelUrl=https://desktop-stage.docker.com/win/main/amd64/appcast.xml [2024-03-13T03:54:54.982972600Z][InstallWorkflow][I] Checking prerequisites [2024-03-13T03:54:55.301899300Z][InstallWorkflow][I] Prompting for optional features [2024-03-13T03:55:48.836177200Z][InstallWorkflow][I] Selected backend mode: wsl-2 [2024-03-13T03:55:48.837178000Z][InstallWorkflow][I] Unpacking artifacts [2024-03-13T03:57:39.572177600Z][InstallWorkflow][I] Deploying component Docker.Installer.CreateGroupAction [2024-03-13T03:57:53.305866500Z][InstallWorkflow][I] Deploying component Docker.Installer.AddToGroupAction [2024-03-13T03:58:02.385550200Z][InstallWorkflow][I] Deploying component Docker.Installer.EnableFeaturesAction [2024-03-13T03:58:02.403595700Z][InstallWorkflow-EnableFeaturesAction][I] Required features: VirtualMachinePlatform, Microsoft-Windows-Subsystem-Linux [2024-03-13T03:58:02.980044400Z][InstallWorkflow][I] Deploying component Docker.Installer.ServiceAction [2024-03-13T03:58:02.982350300Z][InstallWorkflow-ServiceAction][I] Removing service [2024-03-13T03:58:02.984535100Z][InstallWorkflow-ServiceAction][I] Creating service [2024-03-13T03:58:02.986964900Z][InstallWorkflow][I] Deploying component Docker.Installer.ShortcutAction [2024-03-13T03:58:03.003453900Z][InstallWorkflow-ShortcutAction][I] Creating shortcut: C:\ProgramData\Microsoft\Windows\Start Menu\Docker Desktop.lnk/Docker Desktop [2024-03-13T03:58:03.108383600Z][InstallWorkflow][I] Deploying component Docker.Installer.ShortcutAction [2024-03-13T03:58:03.110665600Z][InstallWorkflow-ShortcutAction][I] Creating shortcut: C:\Users\kart\Desktop\Docker Desktop.lnk/Docker Desktop [2024-03-13T03:58:03.112045900Z][InstallWorkflow][I] Deploying component Docker.Installer.AutoStartAction [2024-03-13T03:58:03.114763000Z][InstallWorkflow][I] Deploying component Docker.Installer.PathAction [2024-03-13T03:58:03.527912400Z][InstallWorkflow][I] Deploying component Docker.Installer.ExecAction [2024-03-13T03:58:03.533301600Z][InstallWorkflow-ExecAction][I] Running: D:\software\Docker\InstallerCli.exe -i with timeout=-1 [2024-03-13T03:58:06.207667600Z][InstallWorkflow][I] Registering product [2024-03-13T03:58:06.220682100Z][InstallWorkflow][I] Deleting C:\ProgramData\DockerDesktop\install-settings.json [2024-03-13T03:58:06.222835500Z][InstallWorkflow][I] Installation succeeded
|
更详细的用法,请参考官方文档 windows-install-docker。
以上总结仅供参考哟!最后希望对你的学习和工作有所帮助。
参考资料:
- docker 官方文档: windows-install-docker
—END—