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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构