Devicemapper curiosity

Hi guys,

this days I’m testing out Docker 1.11.2 on a CentOS7 with a direct-lvm devicemapper. I created the thin pool and fed it to docker and everything works fine.

Now I’m curious.

How can I inspect the volumes related to the images that are listed in the “docker images” output? I can find the volumes of running containers using “dmsetup info” but nothing related to the images.

Data is there because I can see that space is being consumed in the pool but couldn’t find any volumes.

Thanks!

I don’t think that makes sense. Images don’t have attached volumes. Without trying to break into Docker space, docker volume ls will list volumes that exist in current Docker.

Dockerfile reference | Docker Docs does suggest that the VOLUME instruction has some special semantics (it makes the named directory immutable for the remainder of the Dockerfile). I haven’t read the source, but it wouldn’t surprise me if the implementation of the “docker run populates volumes on startup” feature was just to copy data out of the existing image.

Interesting. So, my question is: where the files of the image live before being copied to a brand new volume created for a container. And, yet, I wonder what this figure means:

It seems to me that the ubuntu:latest image is an actual snapshot and it should exist as such.

I’m trying to read the code but I don’t know Go and it’s difficult.

Thanks for your reply.

Just to add a bit of information, here is the effect of pulling/deleting an image from the hub on the thin pool:

[root@atlas mapper]# lvs
  LV        VG        Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  docker-tp atlas-vg0 twi-a-t--- 45.00g             0.04   0.01
[root@atlas mapper]# docker pull ubuntu:latest
latest: Pulling from library/ubuntu
43db9dbdcb30: Pull complete
85a9cd1fcca2: Pull complete
c23af8496102: Pull complete
e88c36ca55d8: Pull complete
Digest: sha256:7ce82491d6e35d3aa7458a56e470a821baecee651fba76957111402591d20fc1
Status: Downloaded newer image for ubuntu:latest
[root@atlas mapper]# lvs
  LV        VG        Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  docker-tp atlas-vg0 twi-a-t--- 45.00g             0.44   0.01
[root@atlas mapper]#
[root@atlas mapper]# docker rmi ubuntu
Untagged: ubuntu:latest
Deleted: sha256:ac526a356ca46f915e822e2f8051b9cf3404c756b725661c51191564ae4e6ea7
Deleted: sha256:4247fb52a8da87346107c6a63ce0017826f344b4da5e2f13d55651f3a159716e
Deleted: sha256:2ee485d050041e742f27c9af6a1a1680208ad9d61256abb005e9b8a391e72fd7
Deleted: sha256:860708544664c614b8ab025d5d01ba8f37694e939fd02ce861538bfd7c64cc43
Deleted: sha256:ea9f151abb7e06353e73172dad421235611d4f6d0560ec95db26e0dc240642c1
[root@atlas mapper]# lvs
  LV        VG        Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  docker-tp atlas-vg0 twi-a-t--- 45.00g             0.04   0.01
[root@atlas mapper]#

As you can see, the thinpool is storing the image but I can’t find any device in /dev/mapper or using dmsetup ls. That’s really strange.

Thanks.