Ubuntu20.04操作系统安装Docker

1、添加Docker仓库

bash 复制代码
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

 sudo add-apt-repository \
   "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/ \
  $(lsb_release -cs) \
  stable"

2、安装Docker

bash 复制代码
sudo apt-get install docker-ce docker-ce-cli containerd.io -y

3、添加配置Docker镜像

bash 复制代码
cat <<EOF | tee /etc/docker/daemon.json
{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "registry-mirrors": ["https://aoewjvel.mirror.aliyuncs.com"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  },
  "storage-driver": "overlay2"
}
EOF

4、启动Docker && 加入开机自启动

bash 复制代码
mkdir -p /etc/systemd/system/docker.service.d
systemctl daemon-reload
systemctl restart docker
systemctl enable --now docker
systemctl status docker
相关推荐
fetasty17 小时前
rustfs加picgo图床搭建
docker
蝎子莱莱爱打怪1 天前
GitLab CI/CD + Docker Registry + K8s 部署完整实战指南
后端·docker·kubernetes
小p2 天前
docker学习7:docker 容器的通信方式
docker
小p2 天前
docker学习5:提升Dockerfile水平的5个技巧
docker
小p3 天前
docker学习3:docker是怎么实现的?
docker
小p4 天前
docker学习: 2. 构建镜像Dockerfile
docker
小p4 天前
docker学习: 1. docker基本使用
docker
崔小汤呀5 天前
Docker部署Nacos
docker·容器
缓解AI焦虑5 天前
Docker + K8s 部署大模型推理服务:资源划分与多实例调度
docker·容器
1candobetter5 天前
Docker Compose Build 与 Up 的区别:什么时候必须重建镜像
docker·容器·eureka