https://zhuanlan.zhihu.com/p/25449122072
注意:如果是为 Docker 虚拟机(VM)至少分配 2 个虚拟 CPU(vCPU) 和 8GB 初始内存,否则安装可能会失败。
1. Linux安装Docker
在终端中执行一键安装脚本命令安装docker
sudo curl -fsSL https://gitee.com/tech-shrimp/docker_installer/releases/download/latest/linux.sh | bash -s docker --mirror Aliyun
sudo curl -fsSL https://gitee.com/tech-shrimp/docker_installer/releases/download/latest/linux.sh | bash -s docker --mirror Aliyun
1.1 配置docker镜像源
在终端执行 一行命令,编辑配置文件
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://hub.geekery.cn/",
"https://ghcr.geekery.cn"
]
}
EOF
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://hub.geekery.cn/",
"https://ghcr.geekery.cn"
]
}
EOF
然后重新启动docker服务:
sudo systemctl restart docker
sudo systemctl restart docker
2. Windows安装Docker
选择要安装的Docker版本
下载地址:
- 国内用户优先下载地址:
https://github.com/tech-shrimp/docker_installer/releases/download/latest/docker_desktop_installer_windows_x86_64.exe
https://github.com/tech-shrimp/docker_installer/releases/download/latest/docker_desktop_installer_windows_x86_64.exe
2。适用于Windows的Docker桌面 – x86_64:
https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe?utm_source=docker&utm_medium=webreferral&utm_campaign=docs-driven-download-win-amd64&_gl=1*rjke9f*_gcl_au*MjAxNTA4ODQwMy4xNzI1ODYzMTMx*_ga*MTc3ODM4NTkyMy4xNzI0MDM2OTcw*_ga_XJWPQMJYHQ*MTczMDI2OTA1NC42LjEuMTczMDI2OTQwNC4zOC4wLjA.
https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe?utm_source=docker&utm_medium=webreferral&utm_campaign=docs-driven-download-win-amd64&_gl=1*rjke9f*_gcl_au*MjAxNTA4ODQwMy4xNzI1ODYzMTMx*_ga*MTc3ODM4NTkyMy4xNzI0MDM2OTcw*_ga_XJWPQMJYHQ*MTczMDI2OTA1NC42LjEuMTczMDI2OTQwNC4zOC4wLjA.
如果想自己指定安装目录,可以使用命令行的方式
参数 –installation-dir=D:\Docker可以指定安装位置
start /w "" "Docker Desktop Installer.exe" install --installation-dir=D:\Docker
start /w "" "Docker Desktop Installer.exe" install --installation-dir=D:\Docker
任务栏搜索功能,启用”适用于Linux的Windows子系统” 、”虚拟机平台”
管理员权限打开命令提示符,安装wsl2。
wsl --set-default-version 2
wsl --update --web-download
wsl --set-default-version 2
wsl --update --web-download
等待wsl安装成功。
2.1 Windows配置镜像站
如无科学上网情况,可手动配置镜像站
Setting->Docker Engine->添加上换源的那一段,如下图:
镜像:
{
"builder": {
"gc": {
"defaultKeepStorage": "20GB",
"enabled": true
}
},
"experimental": false,
"features": {
"buildkit": true
},
"registry-mirrors": [
"https://dockerpull.org",
"https://docker.1panel.dev",
"https://docker.foreverlink.love",
"https://docker.fxxk.dedyn.io",
"https://docker.xn--6oq72ry9d5zx.cn",
"https://docker.zhai.cm",
"https://docker.5z5f.com",
"https://a.ussh.net",
"https://docker.cloudlayer.icu",
"https://hub.littlediary.cn",
"https://hub.crdz.gq",
"https://docker.unsee.tech",
"https://docker.kejilion.pro",
"https://registry.dockermirror.com",
"https://hub.rat.dev",
"https://dhub.kubesre.xyz",
"https://docker.nastool.de",
"https://docker.udayun.com",
"https://docker.rainbond.cc",
"https://hub.geekery.cn",
"https://docker.1panelproxy.com",
"https://atomhub.openatom.cn",
"https://docker.m.daocloud.io",
"https://docker.1ms.run",
"https://docker.linkedbus.com"
]
}
镜像:
{
"builder": {
"gc": {
"defaultKeepStorage": "20GB",
"enabled": true
}
},
"experimental": false,
"features": {
"buildkit": true
},
"registry-mirrors": [
"https://dockerpull.org",
"https://docker.1panel.dev",
"https://docker.foreverlink.love",
"https://docker.fxxk.dedyn.io",
"https://docker.xn--6oq72ry9d5zx.cn",
"https://docker.zhai.cm",
"https://docker.5z5f.com",
"https://a.ussh.net",
"https://docker.cloudlayer.icu",
"https://hub.littlediary.cn",
"https://hub.crdz.gq",
"https://docker.unsee.tech",
"https://docker.kejilion.pro",
"https://registry.dockermirror.com",
"https://hub.rat.dev",
"https://dhub.kubesre.xyz",
"https://docker.nastool.de",
"https://docker.udayun.com",
"https://docker.rainbond.cc",
"https://hub.geekery.cn",
"https://docker.1panelproxy.com",
"https://atomhub.openatom.cn",
"https://docker.m.daocloud.io",
"https://docker.1ms.run",
"https://docker.linkedbus.com"
]
}
保存后即可正常使用Docker。
3. MacOS安装Docker
进入此项目的Release,下载Mac系统的安装包:
https://github.com/tech-shrimp/docker_installer/releases
https://github.com/tech-shrimp/docker_installer/releases
注意区分CPU架构类型 Intel芯片选择x86_64, 苹果芯片选择arm64
下载好双击安装即可。
3.1 Mac配置镜像站
Setting->Docker Engine->添加上换源的那一段,如下图:
保存后即可正常使用Docker。
4. Docker镜像查找
也可以在下方链接中搜索想要的镜像:
https://docker.fxxk.dedyn.io/
也可以在下方链接中搜索想要的镜像:
https://docker.fxxk.dedyn.io/
5.Docker常见问题解决
1.Docker 一直显示 Starting the Docker Engine / Docker Engine stopped
解决方法:右键Docker Desktop切换到Windows container
2.Starting the Docker Engine 一直转圈
wsl --unregister docker-desktop
wsl --unregister docker-desktop-data
wsl --unregister docker-desktop
wsl --unregister docker-desktop-data