> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Docker Storage Introduction

> Explains Docker storage fundamentals, storage drivers and volume plugins, persistent data handling, inspection commands, and their relevance to Kubernetes PersistentVolumes and CSI

In this lesson we introduce how storage works for containers and why Docker storage fundamentals matter when you move to Kubernetes. Kubernetes builds on container storage concepts, so understanding Docker's storage drivers and volume plugins makes the transition to Kubernetes storage much clearer.

Why this matters

* Containers are ephemeral by design: a container filesystem can disappear when the container is removed.
* Persistent data requires mechanisms that outlive the container lifecycle — this is where Docker volumes and external storage plugins come in.
* Kubernetes leverages similar principles (PersistentVolumes, CSI drivers), so the mental model you build here transfers directly.

Core Docker storage concepts

* Storage drivers
  * These are part of the Docker engine and implement how image layers are combined and how the container writable layer is managed (the union filesystem).
  * Examples: `overlay2`, `aufs`, `devicemapper`.
  * Impact: choice of storage driver affects performance, disk usage, copy-on-write semantics, and portability across hosts.
* Volume driver plugins
  * Provide persistent storage independent of a container’s lifecycle.
  * Include the built-in `local` driver and third-party plugins that integrate external storage systems (NFS, cloud block storage, etc.).
  * Use case: share data between containers, preserve state across restarts, or mount remote storage into containers.

Quick comparison

| Concept | Purpose | Examples |
| - | - | - |
| Storage driver | Implements container filesystem, manages image and writable layers | `overlay2`, `aufs`, `devicemapper` |
| Volume driver plugin | Provides persistent, shareable storage independent of a container | `local`, NFS, cloud block storage plugins |

How to inspect basic Docker storage details

* Check the active storage driver:

```bash theme={null}
docker info --format '{{.Driver}}'
```

* List Docker volumes:

```bash theme={null}
docker volume ls
```

* Create a simple local volume:

```bash theme={null}
docker volume create mydata
```

Storage driver deep-dive (high-level)

* Union filesystems (e.g., `overlay2`, `aufs`) merge image layers with a writable upper layer for containers. They are typically fast and space-efficient.
* Block-device-backed drivers (e.g., `devicemapper` when used in direct-lvm mode) provide different performance and isolation characteristics and may introduce more complex setup/maintenance requirements.
* Considerations: kernel support, host OS, kernel versions, backing filesystem, and workload I/O patterns all influence the best driver choice.

Volume driver plugins and persistent storage

* The built-in `local` driver is simple, mounts host directories or creates volumes on the host filesystem.
* Third-party plugins (NFS, cloud-provided block/FS drivers) allow containers to use networked or cloud-backed storage that persists beyond container and host lifecycles.
* For distributed or stateful workloads, use networked or cloud-backed storage that supports the access and durability guarantees your application requires.

Implications for Kubernetes storage

* Kubernetes separates the concerns introduced here:
  * Storage drivers = how container images/filesystems work on nodes (node-level detail).
  * Kubernetes introduces PersistentVolumes (PV) and PersistentVolumeClaims (PVC) and relies on CSI (Container Storage Interface) drivers for in-cluster, pluggable storage.
* Understanding Docker storage helps when debugging node-level storage issues, selecting underlying block/FS types for PVs, and choosing or configuring CSI drivers.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/iXPD-mlT91ZNL1uK/images/Certified-Kubernetes-Administrator-CKA/Storage/Docker-Storage-Introduction/docker-storage-volume-drivers.jpg?fit=max&auto=format&n=iXPD-mlT91ZNL1uK&q=85&s=9a5ac43062bbb4b4686d5a655054d35b" alt="The image is a simple slide titled &#x22;Docker Storage&#x22; showing two rounded rectangles labeled &#x22;Storage Drivers&#x22; and &#x22;Volume Drivers.&#x22; It has a dark blue background and minimalist design." width="1920" height="1080" data-path="images/Certified-Kubernetes-Administrator-CKA/Storage/Docker-Storage-Introduction/docker-storage-volume-drivers.jpg" />
</Frame>

<Callout icon="lightbulb" color="#1CB2FE">
  If you’ve already covered Docker storage in the [Docker Training Course for the Absolute Beginner](https://learn.kodekloud.com/user/courses/docker-training-course-for-the-absolute-beginner), you can skip this lesson. Otherwise, continuing will be a helpful refresher before diving into Kubernetes storage concepts.
</Callout>

Links and references

* [Docker Storage Drivers documentation](https://docs.docker.com/storage/storagedriver/)
* [Docker Volumes documentation](https://docs.docker.com/storage/volumes/)
* [Kubernetes Persistent Volumes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/)
* [Container Storage Interface (CSI) specification](https://github.com/container-storage-interface/spec)

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/cka-certification-course-certified-kubernetes-administrator/module/883f0aa9-3aa9-45a6-bd26-3a87ded1e00e/lesson/84190679-209c-4424-ae9f-cb85dbe95766" />
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.