获取 Docker
下载 docker
docker 官网 https://docs.docker.com/get-docker/
在 Windows 上安装 Docker Desktop https://docs.docker.com/desktop/install/windows-install/
Windows 点击这个地方下载:https://desktop.docker.com/win/main/amd64/Docker Desktop Installer.exe
双击 docker 安装包安装
1. 双击 - 默认勾选 - 点击 OK
双击 安装包 Docker Desktop Installer.exe
Configuration 页面 默认都勾选上
2. 需要耐心等待一下安装(预计 3~5 分钟)
3. 安装完成 - 点击 Close
4. 键盘按下 Win 键 - 输入 Docker Desktop
5. 点击 Accept
6. Skip survey
7. 成功打开和运行 docker desktop
配置 docker 镜像加速器
1. 设置
- Docker Engine
2. 获取镜像加速地址
https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
json
{
"builder": {
"gc": {
"defaultKeepStorage": "20GB",
"enabled": true
}
},
"experimental": false,
"registry-mirrors": [
"https://oc6idxrs.mirror.aliyuncs.com"
]
}
3. 添加镜像地址 - 点击 Apply & restart
4. powershell 输入 docker info
console
docker info
滚动到底部 - 找到 Registry Mirrors
出现上面配置的,说明配置成功了
console
Registry Mirrors:
https://oc6idxrs.mirror.aliyuncs.com/
docker info
命令日志
powershell
PS C:\Users\Administrator\Documents\vite-docs> docker info
Client:
Version: 26.0.0
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.13.1-desktop.1
Path: C:\Program Files\Docker\cli-plugins\docker-buildx.exe
compose: Docker Compose (Docker Inc.)
Version: v2.26.1-desktop.1
Path: C:\Program Files\Docker\cli-plugins\docker-compose.exe
debug: Get a shell into any image or container. (Docker Inc.)
Version: 0.0.27
Path: C:\Program Files\Docker\cli-plugins\docker-debug.exe
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.2
Path: C:\Program Files\Docker\cli-plugins\docker-dev.exe
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.23
Path: C:\Program Files\Docker\cli-plugins\docker-extension.exe
feedback: Provide feedback, right in your terminal! (Docker Inc.)
Version: v1.0.4
Path: C:\Program Files\Docker\cli-plugins\docker-feedback.exe
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.1.0
Path: C:\Program Files\Docker\cli-plugins\docker-init.exe
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: C:\Program Files\Docker\cli-plugins\docker-sbom.exe
scout: Docker Scout (Docker Inc.)
Version: v1.6.3
Path: C:\Program Files\Docker\cli-plugins\docker-scout.exe
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 26.0.0
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
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 splunk syslog
Swarm: inactive
Runtimes: runc io.containerd.runc.v2
Default Runtime: runc
Init Binary: docker-init
containerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
Kernel Version: 5.15.146.1-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 32
Total Memory: 15.53GiB
Name: docker-desktop
ID: c739972f-27e2-4816-9720-7cfa3f79cc3a
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
Labels:
com.docker.desktop.address=npipe://\\.\pipe\docker_cli
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5555
127.0.0.0/8
Registry Mirrors:
https://oc6idxrs.mirror.aliyuncs.com/
Live Restore Enabled: false
WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
WARNING: daemon is not using the default seccomp profile
PS C:\Users\Administrator\Documents\vite-docs>
解决 docker 安装失败
错误 1
安装完成后 打开时出现下面错误
解决方法:
点击下载 解决 docker-wsl-错误提示
如果方法 1 不行,就看看这个解决方案 https://blog.csdn.net/i_likechard/article/details/131256766
还是不行的话联系主播
错误 2
修复方法:
(1) 执行下面命令
dism.exe /online /disable-feature /featurename:Microsoft-Windows-Subsystem-Linux /norestart
dism.exe /online /disable-feature /featurename:VirtualMachinePlatform /norestart
(2)重启电脑
(3)执行下面命令
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
(4)控制面板 - 程序卸载 - 卸载 docker desktop
(5)重新安装 docker desktop