Centos 7 Docker 安装

1 内核升级

1.1 更新仓库

yum -y update

1.2 启用ELRepo

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh https://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm

1.3 安装最新内核

yum --enablerepo=elrepo-kernel install kernel-ml

1.4 设置grub2

vi /etc/default/grub

GRUB_DEFAULT=0

[root@localhost software]# vim /etc/default/grub 

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=0
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

grub2-mkconfig -o /boot/grub2/grub.cfg

1.5 重启 reboot

reboot

1.6 删除旧的内核

rpm -qa | grep kernel
yum remove ***


2 安装docker-ce

yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
yum -y install docker-ce
chkconfig docker on
service docker start

3 设置Docker 阿里云镜像

vim /etc/docker/daemon.json

{
    "registry-mirrors": ["https://3hofxgum.mirror.aliyuncs.com"]
}

service docker restart

4 安装docker-compose

curl -L https://github.com/docker/compose/releases/download/1.23.0-rc3/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version

你可能感兴趣的:(Centos 7 Docker 安装)