1、什么是docker
Docker之父Solomon Hykes:Docker就好比传统的货运集装箱
Docker是管理容器的引擎。 Docker为应用打包、部署平台,而非单纯的虚拟化技术
官方站点: https://docs.docker.com/
阿里云开源镜像站: https://mirrors.aliyun.com/docker-ce/linux/centos/7/x86_64/ stable/Packages/
软件包列表:
docker-ce-18.09.6-3.el7.x86_64.rpm
docker-ce-cli-18.09.6-3.el7.x86_64.rpm
containerd.io-1.2.5-3.1.el7.x86_64.rpm
container-selinux-2.21-1.el7.noarch.rpm
2、构建容器
[westos@westos_student74 ~]$ su -
Password:
Last login: Mon Jan 17 19:26:59 CST 2022 on pts/6
Last failed login: Wed Feb 16 10:11:47 CST 2022 on pts/1
There was 1 failed login attempt since the last successful login.
[root@westos_student74 ~]# iptables -t nat -I POSTROUTING -s 172.25.15.1/24 -j MASQUERADE 虚拟机联网
虚拟机:
[westos@westos_student74 Desktop]$ ssh -l root 172.25.15.1
root@172.25.15.1's password:
Last login: Wed Feb 16 10:00:54 2022 from westos_student74.westos.org
[root@server1 ~]# cd /etc/yum.repos.d/
[root@server1 yum.repos.d]# ls
dvd.repo redhat.repo
[root@server1 yum.repos.d]# ping baidu.com 联网成功
PING baidu.com (220.181.38.148) 56(84) bytes of data.
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=1 ttl=52 time=31.1 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=2 ttl=52 time=34.3 ms
^C
--- baidu.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 31.196/32.793/34.390/1.597 ms
镜像获取
curl https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -o docker-ce.repo -o输出
解决依赖性 (centos源)
[root@server1 yum.repos.d]# vim Centos-7.