1. #升级系统内核为 4.44
    2. # CentOS 7.x 系统自带的 3.10.x 内核存在一些 Bugs,导致运行的 Docker、Kubernetes 不稳定,查看内核命令uname -r,升级步骤如下:
    3. rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
    4. #安装完成后检查 /boot/grub2/grub.cfg 中对应内核 menuentry 中是否包含 initrd16 配置,如果没有,再安装一次!
    5. yum --enablerepo=elrepo-kernel install -y kernel-lt #设置开机从新内核启动
    6. grub2-set-default "CentOS Linux (4.4.182-1.el7.elrepo.x86_64) 7 (Core)" #重启
    7. reboot # 查看内核变化啦
    8. #安装docker
    9. wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
    10. yum -y install docker-ce
    11. #镜像加速
    12. vim /etc/docker/daemon.json
    13. {
    14. "data-root": "/data/docker",
    15. "storage-driver": "overlay2",
    16. "insecure-registries": ["registry.access.redhat.com","quay.io"],
    17. "registry-mirrors": ["https://k5oy7o4o.mirror.aliyuncs.com"],
    18. "bid": "172.168.10.0/24",
    19. "exec-opts": ["native.cgroupdriver=systemd"],
    20. "live-restore": true
    21. }
    22. #或者
    23. vim /etc/systemd/system/multi-user.target.wants/docker.service
    24. ExecStart=/usr/bin/dockerd --graph=/data/docker --storage-driver=overlay2 --registry-mirrors=https://k5oy7o4o.mirror.aliyuncs.com --insecure-registries=registry.access.redhat.com --insecure-registries=quay.io --bid=172.168.10.0/24 --exec-opts=native.cgroupdriver=systemd --live-restore=true
    25. #启动
    26. systemctl enable docker && systemctl start docker
    27. #测试
    28. docker info
    29. docker run hello-world
    30. # 运行流程
    31. To generate this message, Docker took the following steps:
    32. 1. The Docker client contacted the Docker daemon.
    33. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.(amd64)
    34. 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading.
    35. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.