1.Linux
推荐使用官方一键安装脚本进行安装/维护,以Ubuntu/Debian为例,需要安装curl:
sudo apt-get install curl
curl -fsSL https://get.docker.com | bash -s docker
安装完成后,运行Docke-HelloWorld测试安装是否成功
systemctl restart docker
docker run hello-world
2.Windows
推荐使用Win10/11中支持WSL2的发行版以安装Docker Desktop
首先打开设置,进入隐私和安全性,进入开发者选项开启开发人员模式,随后打开控制面板中“启用或关闭Windows功能”,开启:
·虚拟机平台
·适用于Windows的Linux子系统
随后打开CMD,输入:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
下载并安装:
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
继续在CMD中输入,设置默认版本为WSL2:
wsl --set-default-version 2
对WSL2进行资源限制,防止内存溢出:
打开C/User/'name',勾选“查看文件后缀”/“查看隐藏文件”,创建".wslconfig",输入:
[wsl2]
memory= 16GB
在CMD中重启WSL2:
wsl --shutdown
在Docker官网下载Docker Desktop并安装,完成后重启计算机:
Comments NOTHING