本实践将在 Ubuntu 22.04.3LTS 系统上进行安装测试
参考资料 : 参考资料
安装操作脚本
root@ubuntu:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
# Uninstall old versions
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
#for pkg in docker-ce docker-ce-cli containerd.io docker-compose-plugin; do sudo apt-get remove $pkg; done
# Add Docker's official GPG key:
apt-get update
apt-get install ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
# https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg
chmod a+r /etc/apt/keyrings/docker.gpg
# Add the repository to Apt sources:
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# https://mirrors.aliyun.com/docker-ce/linux/ubuntu
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# apt-cache madison docker-ce
# apt-cache policy docker-ce
docker network ls
ip addr
#3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
# link/ether 02:42:31:35:7f:10 brd ff:ff:ff:ff:ff:ff
# inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
# valid_lft forever preferred_lft forever
# 更新国内源
curl -X GET https://docker.nju.edu.cn/v2/ubuntu/manifests/latest
curl -X GET https://docker.nju.edu.cn/v2/_catalog
curl -X GET https://docker.nju.edu.cn/v2/ubuntu/tags/list
vim /etc/docker/daemon.json
{
"bip": "192.xxx.xxx.1/24",
"registry-mirrors": [
"https://docker.nju.edu.cn"
]
}
# 开机启动
sudo systemctl enable docker
sudo systemctl start docker
sudo systemctl status docker
原创大约 1 分钟