[Docker] [Ubuntu] 安装 docker 教程
本机环境
简单介绍一下本机环境, 以便出现问题时排查
宿主机硬件:
CPU: Intel Xeon Gold 6138 * 2
Memory: 8 * 32G ECC DDR4 Total: 256G
GPU: Nvidia RTX 4060 8GB
Host System: Windows 11 Pro Workstation
Work System: WSL2-Ubuntu 22.04
.wslconfig
配置文件:
[wsl2]
processors=80
memory=64GB
vmSwitch=LAN
networkingMode=bridged
ipv6=false
dhcp=false
安装 Docker
设置apt
库
sudo apt update && sudo apt upgrade -y # 更新系统软件包
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common # 安装依赖
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg # 添加 Docker GPG 密钥
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null # 添加 Docker 仓库
安装Docker
sudo apt install -y docker-ce docker-ce-cli containerd.io
测试Docker
sudo docker run hello-world
看到以下输出, 说明安装成功
设置自启动
sudo systemctl start docker
sudo systemctl enable docker
(可选) 安装 Docker Compose
sudo apt install -y docker-compose
[Docker] [Ubuntu] 安装 docker 教程
http://localhost:8090/archives/ubuntudockeris