Mount Docker container contents in host file system

Posted by dflemstr on Server Fault See other posts from Server Fault or by dflemstr
Published on 2014-08-18T16:08:28Z Indexed on 2014/08/18 16:28 UTC
Read the original article Hit count: 232

Filed under:
|
|
|

I want to be able to inspect the contents of a Docker container (read-only). An elegant way of doing this would be to mount the container's contents in a directory. I'm talking about mounting the contents of a container on the host, not about mounting a folder on the host inside a container.

I can see that there are two storage drivers in Docker right now: aufs and btrfs. My own Docker install uses btrfs, and browsing to /var/lib/docker/btrfs/subvolumes shows me one directory per Docker container on the system. This is however an implementation detail of Docker and it feels wrong to mount --bind these directories somewhere else.

Is there a proper way of doing this, or do I need to patch Docker to support these kinds of mounts?

© Server Fault or respective owner

Related posts about linux

Related posts about filesystems