目前,CentOS 仅发行版本中的内核支持 Docker。
Docker 运行在 CentOS 7 上,要求系统为64位、系统内核版本为 3.10 以上。
Docker 运行在CentOS-6.5或更高的版本的 CentOS 上,要求系统为64位、系统内核版本为 2.6.32-431 或者更高版本。
Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker 。
通过uname -r命令查看你当前的内核版本
[root@runoob ~]# uname -r
从 2017 年 3 月开始 docker 在原来的基础上分为两个分支版本: Docker CE 和 Docker EE。
Docker CE 即社区免费版,Docker EE 即企业版,强调安全,但需付费使用。
本文介绍 Docker CE 的安装使用。
移除旧的版本:
$ sudo yum remove docker
docker-client
docker-client-latest
docker-common
docker-latest
docker-latest-logrotate
docker-logrotate
docker-selinux
docker-engine-selinux
docker-engine
安装一些必要的系统工具:
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
添加软件源信息:
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
更新 yum 缓存:
sudo yum makecache fast
安装 Docker-ce:
sudo yum -y install docker-ce
启动 Docker 后台服务
sudo systemctl start docker
测试运行 hello-world
[root@runoob ~]# docker run hello-world
由于本地没有hello-world这个镜像,所以会下载一个hello-world的镜像,并在容器内运行。
使用命令docker images查看镜像:
注:
我的机器环境为:
查看系统版本:
cat /etc/redhat-release
[root@localhost tang]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)?
[root@localhost tang]# uname -a
Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost tang]#?
如上步骤已安装成功!
参考:
https://www.runoob.com/docker/centos-docker-install.html
docker默认安装目录:
/var/lib/docker
参考:https://blog.csdn.net/qq_30764991/article/details/81873610
/81873610)