1、设置apt
# Add Docker's aliyun GPG key:
sudo apt update
# 安装必要的软件包
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
# 添加阿里云GPT密钥管理
sudo curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# 进入到/etc/apt/sources.list.d目录
cd /etc/apt/sources.list.d
# 在/etc/apt/sources.list.d目录下的docker.list文件中添加阿里云的镜像下载源
sudo echo "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" > docker.list
# 更新
sudo apt update
2、安装最新版docker
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-compose
3、基本设置
vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://dockerproxy.cn"],
"features": {
"buildkit": true,
"containerd-snapshotter": true
},
"data-root": "/home/data/docker"
}
registry-mirrors为镜像地址,如果有稳定的可以写上
features设置了下载容器时的断点续传,网络不好时非常有用
data-root设置了容器数据存放的位置,非常重要,一定要放在较大的目录中
4、重启守护线程与docker服务
systemctl daemon-reload && systemctl restart docker
标签:容器,list,sudo,ubuntu24.04,apt,etc,ce,Docker,docker From: https://www.cnblogs.com/jinyuanbao/p/18596597