Clean docker environment: devicemapper

前端 未结 4 1267
野性不改
野性不改 2020-11-30 19:55

I have a docker environment with 2 containers (Jenkins and Nexus, both with their own named volume). I have a daily cron-job which deletes unused containers and images. This

4条回答
  •  有刺的猬
    2020-11-30 20:07

    First, what is devicemapper (official documentation)

    Device Mapper has been included in the mainline Linux kernel since version 2.6.9. It is a core part of RHEL family of Linux distributions.

    The devicemapper driver stores every image and container on its own virtual device. These devices are thin-provisioned copy-on-write snapshot devices.
    Device Mapper technology works at the block level rather than the file level. This means that devicemapper storage driver's thin provisioning and copy-on-write operations work with blocks rather than entire files.

    The devicemapper is the default Docker storage driver on some Linux distributions.

    Docker hosts running the devicemapper storage driver default to a configuration mode known as loop-lvm. This mode uses sparse files to build the thin pool used by image and container snapshots

    Docker 1.10 and later no longer matches image layer IDs with directory names in /var/lib/docker.
    However, there are two key directories.

    • The /var/lib/docker/devicemapper/mnt directory contains the mount points for image and container layers.
    • The /var/lib/docker/devicemapper/metadatadirectory contains one file for every image layer and container snapshot.

    If your docker info does show your Storage Driver is devicemapper (and not aufs), proceed with caution with those folders.
    See for instance issue 18867.

提交回复
热议问题