Docker 安装部署

1.Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看CentOS的内核版本

[root@build ~]# uname -a

 

 

2.删除旧的版本的docker

sudo yum remove docker  docker-common docker-selinux docker-engine安装需要的软件包, \

 

3.yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

 

4.设置docker yum

[root@build ~]# sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

已加载插件:fastestmirror

adding repo from: https://download.docker.com/linux/centos/docker-ce.repo

grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo

repo saved to /etc/yum.repos.d/docker-ce.repo

 

5.可以查看所有仓库中所有docker版本,并选择特定版本安装

[root@build ~]# yum list docker-ce --showduplicates | sort -r

已加载插件:fastestmirror

可安装的软件包

 * updates: mirror.hostduplex.com

Loading mirror speeds from cached hostfile

 * extras: mirrors.ocf.berkeley.edu

 * epel: mirror.hmc.edu

docker-ce.x86_64            18.03.0.ce-1.el7.centos             docker-ce-stable

docker-ce.x86_64            17.12.1.ce-1.el7.centos             docker-ce-stable

docker-ce.x86_64            17.12.0.ce-1.el7.centos             docker-ce-stable

docker-ce.x86_64            17.09.1.ce-1.el7.centos             docker-ce-stable

docker-ce.x86_64            17.09.0.ce-1.el7.centos             docker-ce-stable

docker-ce.x86_64            17.06.2.ce-1.el7.centos             docker-ce-stable

docker-ce.x86_64            17.06.1.ce-1.el7.centos             docker-ce-stable

docker-ce.x86_64            17.06.0.ce-1.el7.centos             docker-ce-stable

docker-ce.x86_64            17.03.2.ce-1.el7.centos             docker-ce-stable

docker-ce.x86_64            17.03.1.ce-1.el7.centos             docker-ce-stable

docker-ce.x86_64            17.03.0.ce-1.el7.centos             docker-ce-stable

 * base: mirror.scalabledns.com

 

6.安装docker

sudo yum install docker-ce  #由于repo中默认只开启stable仓库,故这里安装的是最新稳18.03.0.ce-1.el7.centos

$ sudo yum install <FQPN>  #安装指定的版本 例如:sudo yum install docker-ce.x86_64.0.18.03.0.ce-1.el7.cen

 

启动

[root@build ~]# systemctl start docker

[root@build ~]# systemctl status docker

[root@build ~]# systemctl enable docker

posted @ 2018-06-22 09:45  听_风~  阅读(141)  评论(0编辑  收藏  举报