docker的安装
安装docker
使用CentOS7及以上版本
cat /etc/redhat-release
(查看Redhat系的Linux版本)
一、准备安装环境
1、配置网络
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.88.101
NETMASK=255.255.255.0
GATEWAY=192.168.88.2
DNS1=8.8.8.8
[root@localhost ~]# systemctl restart network
进入配置文件修改后重启网络
2、关闭防火墙和selinux
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
临时关闭selinux
3、安装必要的环境和包
[root@localhost ~]# yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
# 图形化安装所需要的包
[root@localhost ~]# yum install -y yum-utils
4、设置为阿里的镜像仓库源 更新yum源
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
1)
[root@localhost ~]# yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo # 阿里云
2)
[root@localhost ~]# yum-config-manager \
--add-repo \
https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo #清华大学云
# 任选一个云即可
5、查看当前版本,有显示就卸载依赖包
[root@localhost ~]# docker version
[root@localhost ~]# yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
6、安装docker-ce
#安装docker
[root@localhost ~]# yum -y install docker-ce docker-ce-cli containerd.io
#查看当前版本
[root@ localhost ~]# docker version
#启动docker
[root@localhost ~]# systemctl restart docker
# 修改daemon配置文件/etc/docker/daemon.json来使用加速器
[root@localhost ~]# mkdir -p /etc/docker
[root@localhost ~]# tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://nxwgbmaq.mirror.aliyuncs.com"]
}
EOF
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl restart docker
作者:陽阳
欢迎任何形式的转载,但请务必注明出处。
限于本人水平,如果文章和代码有表述不当之处,还请不吝赐教。
云计算是一种服务模型,通过网络的方式,获取资源(计算,存储,网络)
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)