前提条件:
目前,CentOS 仅发行版本中的内核支持 Docker。Docker 运行在CentOS 7 (64-bit)上,要求系统为64位、Linux系统内核版本为 3.8以上,这里选用Centos7.x
一:检查环境
1:查看linux内核:uname -a
Linux pgsql01 3.10.0-1062.el7.x86_64 #1 SMP Wed Aug 7 18:08:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
2:查看操作系统版本:cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
二:安装docker
1、如果以前安装过docker,先卸载:
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2、安装相关的:gcc,gcc-c++ 依赖
yum -y install gcc
yum -y install gcc-c++
3、安装 yum的扩展
yum install -y yum-utils
4、使用国内的阿里云镜像库下载:
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
5、更新yum软件包索引 yum makecache fast
安装了 docker :yum -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin
6、把docker设置为开机启动
systemctl start docker # 启动
systemctl status docker # 查看状态
systemctl enable docker # 设置开机自启
ps -ef | grep docker # 查看进程
7、查看docker 版本号: docker -v
Docker version 20.10.22, build 3a2c30b
8、卸载docker相关信息
systemctl stop docker
yum remove docker-ce docker-ce-cli containerd.io docker-compose-plugin
rm -rf /var/lib/docker
rm -rf /var/lib/containerd
标签:ce,centos7,systemctl,yum,install,64,docker,安装 From: https://www.cnblogs.com/xcj26/p/17014005.html