一.docker简介:
1. docker就是类似于一个集装箱,我们只需要把我们做好的服务程序放到箱子里,就可以搬到任何支持docker的主机上运行我们的程序。
2. 容器,image,仓库三者的关系:
二. install docker
1. 安装必要的一些系统工具:
2. 添加软件原信息:
3. 更新并安装docker-ce:
4. 开启docker服务:systemctl start docker
5. 安装校验:
6. 查看docker的具体信息(比如多少个容器,正在运行的有几个,停止的有几个等等)
7. 下载镜像:
8. 启动容器:
9. pull超时解决办法:
[root@docker ~]# dig @114.114.114.114 registry-1.docker.io
; <<>> DiG 9.11.4-P2-RedHat-9.11.4-16.P2.el7_8.2 <<>> @114.114.114.114 registry-1.docker.io
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7686
;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;registry-1.docker.io. IN A
;; ANSWER SECTION:
registry-1.docker.io. 38 IN A 52.4.20.24
registry-1.docker.io. 38 IN A 34.195.246.183
registry-1.docker.io. 38 IN A 3.94.35.164
registry-1.docker.io. 38 IN A 3.218.162.19
registry-1.docker.io. 38 IN A 52.5.11.128
registry-1.docker.io. 38 IN A 3.224.175.179
registry-1.docker.io. 38 IN A 35.174.73.84
registry-1.docker.io. 38 IN A 52.1.121.53
;; Query time: 49 msec
;; SERVER: 114.114.114.114#53(114.114.114.114)
;; WHEN: 一 5月 18 12:53:23 CST 2020
;; MSG SIZE rcvd: 177
[root@docker ~]# vim /etc/hosts
[root@docker ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
52.4.20.24 registry-1.docker.io