Centos7

  1. yum install -y yum-utils device-mapper-persistent-data lvm2
  2. yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
  3. yum makecache fast
  4. yum install docker-ce -y
  5. systemctl start docker
  6. systemctl enable docker

配置镜像加速()

  1. curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
  2. systemctl restart docker

安装其他软件:

  1. yum install unzip wget lrzsz -y

优化:

  1. vi daemon.json
  2. {
  3. "max-concurrent-downloads": 20,
  4. "log-driver": "json-file",
  5. "bridge": "none",
  6. "oom-score-adjust": -1000,
  7. "debug": false,
  8. "log-opts": {
  9. "max-size": "100M",
  10. "max-file": "10"
  11. },
  12. "default-ulimits": {
  13. "nofile": {
  14. "Name": "nofile",
  15. "Hard": 65535,
  16. "Soft": 65535
  17. },
  18. "nproc": {
  19. "Name": "nproc",
  20. "Hard": 65535,
  21. "Soft": 65535
  22. },
  23. "core": {
  24. "Name": "core",
  25. "Hard": -1,
  26. "Soft": -1
  27. }
  28. }
  29. }

Centos8

  1. yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
  2. dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm
  3. yum install docker-ce docker-ce-cli