docker 是一个典型的C/S架构
Docker在2017年以前时使用大版本号+小版本号来名,在2017年之后,采用YY.MM.N-xx格式,如 19.03.1-ce表示2019年3月份的第2个ce版本。以CentOS 7安装docker-ce版本为例
[root@docker-24-20 ~]# uname -r # 确认内核版本,要求大于3.83.10.0-862.el7.x86_64[root@docker-24-20 ~]# wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo[root@docker-24-20 ~]# yum install -y docker-ce # 安装docker-ce[root@docker-24-20 ~]# vim /etc/docker/daemon.json # 初始化配置{"graph": "/data/docker","storage-driver": "overlay2","insecure-registries": ["registry.access.redhat.com","quay.io"],"registry-mirrors": ["https://q2gr04ke.mirror.aliyuncs.com"],"bip": "172.24.20.1/24","exec-opts": ["native.cgroupdriver=systemd"],"log-opts": {"max-size":"32M", "max-file":"2"},"live-restore": true}[root@docker-24-20 ~]# mkdir -p /data/docker[root@docker-24-20 ~]# systemctl start docker && systemctl enable docker[root@docker-24-20 ~]# ip addr show dev docker0 # 确认IP地址3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group defaultlink/ether 02:42:e7:6b:2d:f6 brd ff:ff:ff:ff:ff:ffinet 172.24.20.1/24 brd 172.24.20.255 scope global docker0valid_lft forever preferred_lft forever~]# docker version # 查看版本[root@docker-24-20 ~]# docker container run --rm hello-world # 测试docker是否运行正常Unable to find image 'hello-world:latest' locallylatest: Pulling from library/hello-world1b930d010525: Pull completeDigest: sha256:4fe721ccc2e8dc7362278a29dc660d833570ec2682f4e4194f4ee23e415e1064Status: Downloaded newer image for hello-world:latestHello from Docker!This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps:1. The Docker client contacted the Docker daemon.2. The Docker daemon pulled the "hello-world" image from the Docker Hub.(amd64)3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.To try something more ambitious, you can run an Ubuntu container with:$ docker run -it ubuntu bashShare images, automate workflows, and more with a free Docker ID:https://hub.docker.com/For more examples and ideas, visit:https://docs.docker.com/get-started/
