ubuntu 20.04 安装docker--小白学习之路

更新包

sudo apt-get update

安装需要的软件包以使apt能够通过HTTPS使用仓库 sudo apt-get install ca-certificates curl gnupg lsb-release

使用清华大学源

添加Docker官方的GPG密钥

curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

设置稳定版仓库

echo "deb arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

使用阿里云源

添加阿里云官方GPG密钥

curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add - # 写入阿里云Docker仓库地址

sudo sh -c 'echo "deb arch=amd64 http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list'

更新源并安装Docker

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io

验证是否成功安装了

docker sudo systemctl status docker

docker --version

修改docker的/etc/docker/daemon.json配置文件,如果在不存在则手动创建,文件内容如下。

修改daemon.json文件,

vim /etc/docker/daemon.json

daemon.json内容如下:

{ "registry-mirrors": "https://dockerproxy.com", "https://docker.m.daocloud.io", "https://cr.console.aliyun.com", "https://ccr.ccs.tencentyun.com", "https://hub-mirror.c.163.com", "https://mirror.baidubce.com", "https://docker.nju.edu.cn", "https://docker.mirrors.sjtug.sjtu.edu.cn", "https://github.com/ustclug/mirrorrequest", "https://registry.docker-cn.com" }

重载配置文件,并重启

docker sudo systemctl daemon-reload

sudo systemctl restart docker

查看 Registry Mirrors 配置是否成功

sudo docker info

参考链接:ubuntu 20.04 国内源安装docker - lqqgis - 博客园

相关推荐
一隅论数智3 天前
给AI一张“业务概念地图“:本体如何从哲学走向企业智能
大数据·人工智能·经验分享·笔记·学习·学习方法·政务
XiHongShi20163 天前
STM32F407 RTC定时器例程,建议保存
stm32·单片机·学习
爱吃苹果的日记本3 天前
离散数学第六课
学习·离散数学
分布式存储与RustFS3 天前
MinIO 官方 Docker 镜像被移除:依赖它的项目该怎么办
docker·云原生·devops·对象存储·minio·分布式存储
AI职业加油站3 天前
AI智能体应用工程师证书:政策红利下的职业新风口
大数据·运维·人工智能·学习·职场发展
旖旎夜光3 天前
力控面试题 01.01: 判定字符是否唯一(位运算) —— 题解
c++·学习·算法·leetcode·力控
奇思妙想聪明勤奋的小羊3 天前
DeepAgents第5章:子Agent 与上下文隔离—让 Agent学会委派
人工智能·python·学习·语言模型
霍霍的袁3 天前
【C++】map 和 set 的使用 | 从用法到底层
开发语言·c++·学习·visual studio
彧azz3 天前
Linux 环境下 Redis 学习总结:数据类型、持久化、锁、事务、主从与缓存问题
linux·redis·笔记·学习·面试