DevOps Classroom Series – 08/Nov/2020

Managing application Data in Containers

  • Every Container gets a read write layer extra on top of image layers Preview
  • Two concerns to be addressed are
    • How does docker container mount image layers + R/W layer as one file system ?
      • Storage Drivers
    • How to preserve the data which is present in R/W Layer
      • Docker Volumes

Storage Drivers

  • Copy-on-write Strategy: Preview
  • We need a file system which understands image layers and R/W Layers and to the continer it should be file system much like any other linux/Windows file system
  • Storage Driver understands read only image layers, Read/Write Thin layer of container and combines (union) the layers to give one filesystem to container
  • Docker has the following storage drivers
    • overlay2: This is preferred storage driver for all linux distributions
    • aufs: This was preferred storage driver for Docker 18.06 and previous versions
    • devicemapper
    • btrfs and zfs
  • Refer Here for article on storage drivers

Docker Volumes

  • Refer Here for article on Docker Volumes
  • By default all the files created by container are stored on thin R/w layer. This layer will be existing on a system as long as container exists. Once the container is deleted this data will be lost
  • Docker has two options for storing the files on the host machine, so that the changes done in the container are persisted even after contianer is deleted.
    • Volumes
    • Bind Mount
  • Create a Docker Image from the file without Volume instruction and with volume instruction Refer Here for changeset Preview
  • Now lets create a docker container from image without volume instruction and other with volume instruction Preview Preview
  • Even after the container is terminated data will still exist on the docker host
  • What if the VOLUME instruction is not used in Docker Image?
  • If your organization is running some kind of third party storage like netapp, vsphere storage etc Refer Here to install volume drivers
  • Refer Here for cloud related storage drivers

Host Network and Guest Network in Networking

Preview

Docker Networking

  • Launch a virtual machine with plain os (ubuntu /centos).
  • Execute the command ifconfig Preview
  • Now lets install docker and then execute ifconfig Preview
  • Now just run the following command
docker container run -d --name my-cont-1 tomcat:jdk8-openjdk
docker container inspect my-cont-1

Preview

  • Now execute ifconfig Preview
  • What is happening to make containers accesible via host network?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin