Introduction to Docker Storage Drivers:
Docker stockpiling driver, otherwise called diagram driver gives a component to store and oversee pictures and holders on Docker have. Docker utilizes a pluggable design that upholds different capacity drivers. Capacity drivers permit our responsibilities to keep in touch with the compartment's writable layer. There are a few different stockpiling drivers upheld by Docker, we want to pick the best stockpiling driver for our responsibilities. To pick the best stockpiling driver, it is critical to comprehend the most common way of building and putting away pictures in Docker and how these pictures are utilized by compartments. The default stockpiling driver is overlay2 and it is upheld on Docker Engine - Community, and Docker EE 17.06.02-ee5 and up, notwithstanding, we can transform it according to our necessity.
Different Storage Drivers of Docker:
Below are different storage drivers supported by Docker: –
- It is the default stockpiling driver presently.
- It is upheld by Docker Engine - Community, and Docker EE 17.06.02-ee5 and fresher rendition.
- It is fresher and more steady than its unique driver called 'overlay'.
- The support filesystem for overlay2 and overlay driver is off.
- It is upheld by Linux part form 4.0 or higher, variant 3.10.0-514 or higher of RHEL or CentOS is expected for overlay2 in any case we want to utilize overlay stockpiling driver that isn't suggested.
- Overlay2 and overlay drivers go under Linux portion driver OverlayFS stockpiling driver which is a cutting edge association filesystem and it is like aufs, nonetheless, OverlayFs is quicker and simple to execute.
- AUFS is an association filesystem, and that implies it presents various indexes called branches in AUFS as a solitary registry on a solitary Linux have. These catalogs are known as layers in Docker.
- It was the default stockpiling driver before overlay2 used to oversee pictures and layers on Docker for Ubuntu, and for Debian forms before Stretch. It was the default stockpiling driver in Ubuntu 14.04 and prior.
- This driver is great for Platform as a Service where compartment thickness is significant in lighbecausean divides the pictures among various running holders proficiently.
- It gives a quick compartment startup and uses less plate space as AUFS divides pictures among different running holders.
- It utilizes memory productively, notwithstanding, not effective in composing weighty jobs as latencies are high while keeping in touch with the compartment since it has different catalogs so the record should be found and duplicated to holders top writable layer.
- It ought to be utilized with Solid State Drives for quicker read and composes than turning circle and use volumes for composing weighty responsibilities to improve execution.
- The support filesystem for AUFS is xfs and ext4 Linux document framework.
- It is a square stockpiling driver that stores information in blocks.
- It is great for composing composing responsibilities as it stores information at the square level rather than the document level.
- It is a portion-based structure and Docker's device-mapper stockpiling driver exploits its capacities like the meager arrangement and snapshotting to oversee pictures and compartments.
- It was the default stockpiling driver for CentOS 7 and prior.
- It upholds two modes:
circle lvm mode:
- circle lvm is utilized to recreate documents on the neighborhood plate as a genuine actual circle or square gadget by utilizing the 'loopback' instrument. It is because of the device-mapper just backings outer or block gadgets.
- It is helpful for testing just as it gives terrible execution.
- It is not difficult to set up as doesn't need an outside gadget
- It requires extra gadgets to be joined to the localhost as it local hosts information on a different gadget.
- It is creation prepared and gives better execution.
- It requires a mind-boggling arrangement to empower direct-lvm.
- We want to design the daemon.json document to utilize direct-lvm mode. It has different choices that can be set up according to the prerequisite.
- The lvm2 and gadget mapper-relentless information bundles should be introduced to utilize device-mapper.
- It utilizes direct-lvm as a sponsorship filesystem.
- This capacity driver is additionally important for the primary Linux portion.
- It is just upheld on SLES ( Suse Linux Enterprise Server) for Docker EE and CS motor.
- Be that as it may, it is suggested for Ubuntu or Debian for Docker Engine - Community release.
- btrfs driver supported by Btrfs filesystem which is a cutting edge duplicate on-compose filesystem.
- Btrfs filesystem has many highlights, for instance, block-level tasks, meager provisioning, duplicate on-compose depictions, and so on these elements of Btrfs are utilized by Docker's btrfs stockpiling driver to oversee pictures and holders.
- It likewise requires committed square stockpiling and should be designed with Btrfs filesystem, nonetheless, we don't need a separate square gadget assuming involving SLES as it is organized with Btrfs naturally. It is prescribed to involve extra square gadgets for better execution.
- Our bit should uphold btrfs.
- It is publicly released under CDDL (Common Development and Distribution License) and made by Sun Microsystems (presently Oracle Corporation).
- It is additionally a cutting edge filesystem that has many elements like volume of the executives, depictions, checksumming, pressure and deduplication, replication, and so on
- It isn't important for the mainline Linux part due to authorizing contrary qualities between the CDDL and GPL.
- It isn't prescribed to involve this Docker stockpiling driver for creation responsibilities without significant involvement in ZFS.
- It is just upheld on Docker CE with Ubuntu 14.04 or higher.
- It isn't upheld on Docker EE or CS-motor.
- It is just for the end goal of testing and not suggested for creation use.
- The presentation is poor for this capacity driver.
- It tends to be upheld on any filesystem where no duplicate on-compose filesystem can be utilized.
Examples of Docker Storage Drivers:
Let’s learn some commands to know about Docker’s storage driver with examples: –
We use the ‘docker info’ command to check the default driver used by Docker as below: –
Explanation: – In the above snapshot, we can see that the ‘overlay’ storage driver is used by Docker.
Now we want to configure the Docker to use ‘overlay2’ as a default storage driver, we can do that by editing the ‘daemon.json’ file located at /etc/docker/daemon.json as below: –
Step1: First stop docker service using below command: –
$sudo systemctl stop docker
Step2: Add the below configuration to the ‘daemon.json’ file, create the file if it does not exist.
Step3: Start the docker service again as below: –
$sudo systemctl start docker
We can run a container and check which driver is being used by that container: –
$docker run -d --name test_container ubuntu
$docker inspect test_container | grep -i ‘graph’ -A 8
Explanation: – In the above example, we can see that the ‘overlay2’ graph driver or storage driver is being used by a newly created container.
There are a few different stockpiling drivers accessible that are upheld by Docker. We need to comprehend the usefulness of each driver and pick which driver is the most appropriate for our jobs. We consider three undeniable level variables while choosing Docker's stockpiling driver are by and large execution, shared capacity framework, and steadiness.