Foreward
之前对于docker的理解就是容器,但什么是容器呢?这个也没有去思考,借助pause容器的说明,顺便梳理下docker容器是什么?
docker容器实际是利用Linux的namespace和cgroup达到容器化的目的.
Two feature of Linux kernel
linux有两个重要的特性,namespace和cgroup(control group).他们用于对资源进行隔离.
打个比方,就像你去买商品房,每套都是用混泥土墙隔开,保证别人不会闯到你家.这个可以类比为cgroup,而cgroup就是linux对机器的物理资源(cpu,内存,磁盘io)的隔离.买完了房子,那产权当然是属于你,而不是别人(可能有小三),另外,住进去后你要用水、用电、用网络,对其他人也一样,但是每户各自结算,这就像linux环境中的user namespace、network namespace等,属于环境的隔离.
由于能力有限,只能先这么去理解.这里罗列左耳朵耗子的文章.
AUFS 、DEVICEMAPPER
对于这两个的理解,AUFS是文件管理系统,用于对文件进行分层.
具体可以看耗子叔的这两篇文章.
DOCKER基础技术:AUFS
DOCKER基础技术:DEVICEMAPPER
Pause
In Kubernetes, the pause container serves as the “parent container” for all of the containers in your pod. The pause container has two core responsibilities. First, it serves as the basis of Linux namespace sharing in the pod. And second, with PID (process ID) namespace sharing enabled, it serves as PID 1 for each pod and reaps zombie processes.
对于pause的理解