CentOS7.9安装Docker

1、安装需要的软件包, yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的

yum install -y yum-utils device-mapper-persistent-data lvm2

2、设置yum源(选择其中一个)

1. yum-config-manager --add-repo http://download.docker.com/linux/centos/docker-ce.repo(中央仓库)
2. yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo(阿里仓库)

3、安装(开源社区版本)

yum -y install docker-ce

4、启动docker并加入开机启动

1.systemctl start docker
2.systemctl enable docker

5、查看安装的版本

docker version

6、测试hello-world(需要FQ,可能会拉取不下来)

docker pull hello-world

7、运行hello-world

docker run hello-world

8、编辑 /etc/docker/daemon.json  (如果以下地址失效请自行找有效地址)

vim /etc/docker/daemon.json
复制代码
{
   "registry-mirrors": [
   "https://docker.m.daocloud.io",
   "https://dockerproxy.com",
   "https://docker.mirrors.ustc.edu.cn",
   "https://docker.nju.edu.cn",
   "https://docker-proxy.741001.xyz",
   "https://registry.docker-cn.com"
   ]
}
复制代码

9、重新加载配置,并重新启动docker,再次拉取hello-world即可

1. systemctl daemon-reload
2. systemctl restart docker

 

posted @   斌言  阅读(406)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
点击右上角即可分享
微信分享提示