安装docker

一、修改yum源

1.安装wget

yum install wget

2.备份系统自带yum源配置文件

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

3.下载ailiyun的yum源配置文件到/etc/yum.repos.d/

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

二、安装docker

前提条件
目前,CentOS 仅发行版本中的内核支持 Docker。
Docker 运行在 CentOS 7 上,要求系统为64位、系统内核版本为 3.10 以上。
Docker 运行在 CentOS-6.5 或更高的版本的 CentOS 上,要求系统为64位、系统内核版本为 2.6.32-431 或者更高版本。

#查看你当前的内核版本
uname -r

#安装 Docker
yum -y install docker

#启动 Docker 后台服务
service docker start

#测试运行 hello-world,由于本地没有hello-world这个镜像,所以会下载一个hello-world的镜像,并在容器内运行。
docker run hello-world

#查看镜像
docker image ls

三、设置开机启动

sudo systemctl enable docker

2020-12-04 11:04

posted @ 2020-11-10 19:54  划破黑夜  阅读(41)  评论(0编辑  收藏  举报