21 Days of Docker-Day 12-Docker Storage – Part 1

Welcome to Day 12 of 21 Days of Docker. Before I go into the in-depth of this topic, this first question we need to ask ourselves

  • When we perform any write operation inside the container where is that data got stored?
  • Do my containers need any external storage?

Let’s go back to Day 8 where I explained about Docker Images, Layers and Containers

  • If you remember this, I talked about container writable layer, which is the top layer, By default, all files created inside a container are stored on a writable container layer.

Now try to visualize the problem you will face if the container doesn’t exist

  • You will lose all the data

Now try to think who is responsible for managing these different imager layers as well as the top container writable layer?

  • Yes, you guessed it, right Storage Driver, Storage Driver put all these things together for you. The storage driver provides a union filesystem, using the Linux kernel.

To Check storage driver in your system

# docker info |grep Storage
 Storage Driver: overlay2

To check docker’s local storage area

# docker info |grep "Docker Root Dir"
 Docker Root Dir: /var/lib/docker

Storage drivers: Storage driver to use often depends on your operating system and other local configuration factors.

  • The overlay storage driver is deprecated in Docker Engine – Enterprise 18.09, and will be removed in a future release. It is recommended that users of the overlay storage driver migrate to overlay2.
  • The devicemapper storage driver is deprecated in Docker Engine 18.09, and will be removed in a future release. It is recommended that users of the devicemapper storage driver migrate to overlay2.

When possible, overlay2 is the recommended storage driver. When installing Docker for the first time, overlay2 is used by default. Previously, aufs was used by default when available, but this is no longer the case.