docker 是一个典型的C/S架构
    Docker在2017年以前时使用大版本号+小版本号来名,在2017年之后,采用YY.MM.N-xx格式,如 19.03.1-ce表示2019年3月份的第2个ce版本。以CentOS 7安装docker-ce版本为例

    1. [root@docker-24-20 ~]# uname -r # 确认内核版本,要求大于3.8
    2. 3.10.0-862.el7.x86_64
    3. [root@docker-24-20 ~]# wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    4. [root@docker-24-20 ~]# yum install -y docker-ce # 安装docker-ce
    5. [root@docker-24-20 ~]# vim /etc/docker/daemon.json # 初始化配置
    6. {
    7. "graph": "/data/docker",
    8. "storage-driver": "overlay2",
    9. "insecure-registries": ["registry.access.redhat.com","quay.io"],
    10. "registry-mirrors": ["https://q2gr04ke.mirror.aliyuncs.com"],
    11. "bip": "172.24.20.1/24",
    12. "exec-opts": ["native.cgroupdriver=systemd"],
    13. "log-opts": {"max-size":"32M", "max-file":"2"},
    14. "live-restore": true
    15. }
    16. [root@docker-24-20 ~]# mkdir -p /data/docker
    17. [root@docker-24-20 ~]# systemctl start docker && systemctl enable docker
    18. [root@docker-24-20 ~]# ip addr show dev docker0 # 确认IP地址
    19. 3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    20. link/ether 02:42:e7:6b:2d:f6 brd ff:ff:ff:ff:ff:ff
    21. inet 172.24.20.1/24 brd 172.24.20.255 scope global docker0
    22. valid_lft forever preferred_lft forever
    23. ~]# docker version # 查看版本
    24. [root@docker-24-20 ~]# docker container run --rm hello-world # 测试docker是否运行正常
    25. Unable to find image 'hello-world:latest' locally
    26. latest: Pulling from library/hello-world
    27. 1b930d010525: Pull complete
    28. Digest: sha256:4fe721ccc2e8dc7362278a29dc660d833570ec2682f4e4194f4ee23e415e1064
    29. Status: Downloaded newer image for hello-world:latest
    30. Hello from Docker!
    31. This message shows that your installation appears to be working correctly.
    32. To generate this message, Docker took the following steps:
    33. 1. The Docker client contacted the Docker daemon.
    34. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    35. (amd64)
    36. 3. The Docker daemon created a new container from that image which runs the
    37. executable that produces the output you are currently reading.
    38. 4. The Docker daemon streamed that output to the Docker client, which sent it
    39. to your terminal.
    40. To try something more ambitious, you can run an Ubuntu container with:
    41. $ docker run -it ubuntu bash
    42. Share images, automate workflows, and more with a free Docker ID:
    43. https://hub.docker.com/
    44. For more examples and ideas, visit:
    45. https://docs.docker.com/get-started/