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
相关推荐
沐风_ZTL2 小时前
ubuntu中 使用C++ FFmpeg拉取RTSP视频流
c++·ubuntu·ffmpeg
m0nesy_86802 小时前
Kubernetes云原生技术和docker的区别(deepseek R1)
docker·云原生·kubernetes
web150854159353 小时前
【rustdesk】客户端和服务端的安装和部署(自建服务器,docker,远程控制开源软件rustdesk)
运维·服务器·docker
Kasen's experience4 小时前
Debian安装Seafile
docker·debian·seafile
hunter2062065 小时前
ubuntu的terminator设置自动补全
linux·运维·ubuntu
hunter2062066 小时前
ubuntu和手机之间如何传递消息
linux·ubuntu·智能手机
枫叶20008 小时前
Windows Docker笔记-Docker拉取镜像
windows·笔记·docker
狂爱代码的码农11 小时前
docker,k8s,docker compose三者的关系
docker
化尘归一11 小时前
虚拟机搭建---K8S环境
云原生·容器·kubernetes
m0_7482561411 小时前
使用 Docker 部署 RabbitMQ 的详细指南
docker·容器·rabbitmq