Home Explore Blog Models CI



docker

1st chunk of `content/manuals/engine/storage/drivers/device-mapper-driver.md`
6b9e1bdc61c82d979684025ff0eb2073236ac759d0513a410000000100000fb7
---
description: Learn how to optimize your use of device mapper driver.
keywords: container, storage, driver, device mapper
title: Device Mapper storage driver (deprecated)
aliases:
  - /storage/storagedriver/device-mapper-driver/
---

> **Deprecated**
>
> The Device Mapper driver [has been deprecated](/manuals/engine/deprecated.md#device-mapper-storage-driver),
> and is removed in Docker Engine v25.0. If you are using Device Mapper,
> you must migrate to a supported storage driver before upgrading to Docker
> Engine v25.0. Read the [Docker storage drivers](select-storage-driver.md)
> page for supported storage drivers.

Device Mapper is a kernel-based framework that underpins many advanced
volume management technologies on Linux. Docker's `devicemapper` storage driver
leverages the thin provisioning and snapshotting capabilities of this framework
for image and container management. This article refers to the Device Mapper
storage driver as `devicemapper`, and the kernel framework as _Device Mapper_.

For the systems where it is supported, `devicemapper` support is included in
the Linux kernel. However, specific configuration is required to use it with
Docker.

The `devicemapper` driver uses block devices dedicated to Docker and operates at
the block level, rather than the file level. These devices can be extended by
adding physical storage to your Docker host, and they perform better than using
a filesystem at the operating system (OS) level.

## Prerequisites

- `devicemapper` is supported on Docker Engine - Community running on CentOS, Fedora,
  SLES 15, Ubuntu, Debian, or RHEL.
- `devicemapper` requires the `lvm2` and `device-mapper-persistent-data` packages
  to be installed.
- Changing the storage driver makes any containers you have already
  created inaccessible on the local system. Use `docker save` to save containers,
  and push existing images to Docker Hub or a private repository, so you do
  not need to recreate them later.

## Configure Docker with the `devicemapper` storage driver

Before following these procedures, you must first meet all the
[prerequisites](#prerequisites).

### Configure `loop-lvm` mode for testing

This configuration is only appropriate for testing. The `loop-lvm` mode makes
use of a 'loopback' mechanism that allows files on the local disk to be
read from and written to as if they were an actual physical disk or block
device.
However, the addition of the loopback mechanism, and interaction with the OS
filesystem layer, means that IO operations can be slow and resource-intensive.
Use of loopback devices can also introduce race conditions.
However, setting up `loop-lvm` mode can help identify basic issues (such as
missing user space packages, kernel drivers, etc.) ahead of attempting the more
complex set up required to enable `direct-lvm` mode. `loop-lvm` mode should
therefore only be used to perform rudimentary testing prior to configuring
`direct-lvm`.

For production systems, see
[Configure direct-lvm mode for production](#configure-direct-lvm-mode-for-production).

1. Stop Docker.

   ```console
   $ sudo systemctl stop docker
   ```

2.  Edit `/etc/docker/daemon.json`. If it does not yet exist, create it. Assuming
    that the file was empty, add the following contents.

    ```json
    {
      "storage-driver": "devicemapper"
    }
    ```

    See all storage options for each storage driver in the
    [daemon reference documentation](/reference/cli/dockerd/#options-per-storage-driver)

    Docker does not start if the `daemon.json` file contains badly-formed JSON.

3.  Start Docker.

    ```console
    $ sudo systemctl start docker
    ```

4.  Verify that the daemon is using the `devicemapper` storage driver. Use the
    `docker info` command and look for `Storage Driver`.

    ```console
    $ docker info

      Containers: 0
        Running: 0
        Paused: 0
        Stopped: 0
      Images: 0
      Server Version: 17.03.1-ce
      Storage Driver: devicemapper
      Pool Name: docker-202:1-8413957-pool

Title: Device Mapper Storage Driver (Deprecated)
Summary
The Device Mapper storage driver is deprecated and will be removed in Docker Engine v25.0. It uses the Device Mapper framework in the Linux kernel for image and container management. The driver is supported on several distributions like CentOS, Fedora, SLES, Ubuntu, Debian, or RHEL. The document describes the prerequisites and configuration steps for both loop-lvm (testing) and direct-lvm (production) modes, and emphasizes the need to migrate to a supported storage driver.