Saturday, December 23, 2017

Docker Terminology : Images

There are few basic anologies
 
Docker Images
  • List of everything that is in our containers
  • And Instructions how to build it 
  • They launch docker containers.
  • They comprise of multiple layers
  • stored locally at /var/lib/docker/ ex /var/lib/docker/aufs 
  • Are generally much smaller in size than OS ( as made of layers )
  • Single Image may be shared by multiple containers.
  • Whenever conflicts in layers , highest ones always wins.







Image Layering is accomplished by Union Mounts.  Instead of mounting one file system like root , it allows to mount multiple file system on top of each other. plus they combine all of the layers into a single view.

Note
  • top r/w image will be of different size based on different amount of work done.
  • rootfs of container is always read only
  • in normal linux boot scenario rootfs gets mounted as readonly , then later in process get remounted as readwrite.
  • the top writable layer gives look and feel of r/w rootfs. ( i think its because of rule in case of conflict higher layer always gets priority )
  • all containers in a sungle system share the kernel of hostOS ( this  makes no difference to us as a developer or admin )


You can see the relationship between image layers by tree command



You can see the same relationship by the directory structure as well



I think /diff/ has actual data
See how different layers have different part of filesystem


You can run
  • docker pull -a fedora
  • docker images fedora

No comments: