知识点1: CentOS7系统安装Docker


    知识点2: Ubuntu18.04系统安装Docker

    1. apt-get remove docker docker-engine docker.io containerd runc
    2. apt-get update
    3. #添加使用 https 传输的软件包和 CA证书
    4. apt-get install apt-transport-https ca-certificates curl software-properties-common -y
    5. #添加软件源的GPG密钥
    6. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
    7. #添加docker软件源
    8. add-apt-repository \
    9. "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
    10. $(lsb_release -cs) \
    11. stable"
    12. #安装docker-ce
    13. apt-get install docker-ce docker-ce-cli containerd.io -y
    14. #查找Docker-CE的版本
    15. apt-cache madison docker-ce
    16. #安装指定版本的Docker-CE,比如要安装19.03.8~3-0~ubuntu-bionic
    17. apt-get -y install docker-ce=19.03.8~3-0~ubuntu-bionic
    18. #创建daemon.json配置文件
    19. root@node01:~# cat /etc/docker/daemon.json
    20. {
    21. "registry-mirrors": ["https://dockerhub.mirrors.nwafu.edu.cn/"]
    22. }
    23. #加载配置,重启docker服务
    24. root@node01:~# systemctl daemon-reload
    25. root@node01:~# systemctl start docker
    26. root@node01:~# systemctl status docker
    27. docker.service - Docker Application Container Engine
    28. Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
    29. Active: active (running) since Fri 2021-03-12 10:12:25 CST; 4h 27min ago
    30. Docs: https://docs.docker.com
    31. Main PID: 8774 (dockerd)
    32. Tasks: 9
    33. CGroup: /system.slice/docker.service
    34. └─8774 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock