Understanding docker directory structure


I have docker installed on my Fedora box. Here I try to understand the structure of its directories.

[root@mylab docker]# docker version
Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.3.3
Git commit (client): a8a31ef/1.5.0
OS/Arch (client): linux/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.3.3
Git commit (server): a8a31ef/1.5.0

[root@mylab docker]# rpm -ql docker-io
/etc/docker # This is where cert key pair stores, it is used for authentication for remote API call.
/etc/sysconfig/docker # This defines how docker daemon runs. e.g. DOCKER_CERT_PATH which by default is /etc/docker
/etc/sysconfig/docker-network # This defines DOCKER_NETWORK_OPTIONS
/etc/sysconfig/docker-storage # This defines DOCKER_STORAGE_OPTIONS
/etc/udev/rules.d/80-docker.rules # This hides docker’s loopback device from udisks, and thus from user desktops
/usr/bin/docker # docker binary
/usr/lib/systemd/system/docker.service # Systemd managed docker daemon, where uses the parameters that defines above (e.g. Network, Storage)
/usr/libexec/docker
/usr/libexec/docker/dockerinit
/usr/share/bash-completion/completions/docker # bash completion file for core docker commands
/usr/share/doc/docker-io
/usr/share/doc/docker-io/AUTHORS
/usr/share/doc/docker-io/CHANGELOG.md
/usr/share/doc/docker-io/CONTRIBUTING.md
/usr/share/doc/docker-io/LICENSE
/usr/share/doc/docker-io/LICENSE-vim-syntax
/usr/share/doc/docker-io/MAINTAINERS
/usr/share/doc/docker-io/NOTICE
/usr/share/doc/docker-io/README-vim-syntax.md
/usr/share/doc/docker-io/README.md
/usr/share/man/man1/docker-attach.1.gz
/usr/share/man/man1/docker-build.1.gz
/usr/share/man/man1/docker-commit.1.gz
/usr/share/man/man1/docker-cp.1.gz
/usr/share/man/man1/docker-create.1.gz
/usr/share/man/man1/docker-diff.1.gz
/usr/share/man/man1/docker-events.1.gz
/usr/share/man/man1/docker-exec.1.gz
/usr/share/man/man1/docker-export.1.gz
/usr/share/man/man1/docker-history.1.gz
/usr/share/man/man1/docker-images.1.gz
/usr/share/man/man1/docker-import.1.gz
/usr/share/man/man1/docker-info.1.gz
/usr/share/man/man1/docker-inspect.1.gz
/usr/share/man/man1/docker-kill.1.gz
/usr/share/man/man1/docker-load.1.gz
/usr/share/man/man1/docker-login.1.gz
/usr/share/man/man1/docker-logout.1.gz
/usr/share/man/man1/docker-logs.1.gz
/usr/share/man/man1/docker-pause.1.gz
/usr/share/man/man1/docker-port.1.gz
/usr/share/man/man1/docker-ps.1.gz
/usr/share/man/man1/docker-pull.1.gz
/usr/share/man/man1/docker-push.1.gz
/usr/share/man/man1/docker-rename.1.gz
/usr/share/man/man1/docker-restart.1.gz
/usr/share/man/man1/docker-rm.1.gz
/usr/share/man/man1/docker-rmi.1.gz
/usr/share/man/man1/docker-run.1.gz
/usr/share/man/man1/docker-save.1.gz
/usr/share/man/man1/docker-search.1.gz
/usr/share/man/man1/docker-start.1.gz
/usr/share/man/man1/docker-stats.1.gz
/usr/share/man/man1/docker-stop.1.gz
/usr/share/man/man1/docker-tag.1.gz
/usr/share/man/man1/docker-top.1.gz
/usr/share/man/man1/docker-unpause.1.gz
/usr/share/man/man1/docker-version.1.gz
/usr/share/man/man1/docker-wait.1.gz
/usr/share/man/man1/docker.1.gz
/usr/share/man/man5/Dockerfile.5.gz
/var/lib/docker # This where images and containers are stored

[root@mylab ~]# docker images -a
REPOSITORY                        TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
myrepo                            rhel7_httpd         3310574481b2        11 days ago         261.5 MB
registry.access.redhat.com/rhel   7.1-4               10acc31def5d        10 weeks ago        154.1 MB
registry.access.redhat.com/rhel   latest              10acc31def5d        10 weeks ago        154.1 MB

[root@mylab ~]# docker ps -a
CONTAINER ID        IMAGE                COMMAND                CREATED             STATUS                           PORTS               NAMES
fa3339efba15        myrepo:rhel7_httpd   “/bin/bash”            2 days ago          Exited (0) 2 days ago                                mytest
261e9d1f711e        myrepo:rhel7_httpd   “/bin/python -m Simp   5 days ago          Exited (137) About an hour ago                       python_web

[root@mylab ~]# tree /var/lib/docker
/var/lib/docker
├── containers # Where containers are saved
│   ├── 261e9d1f711e10945f1ad40d9ee5a5d892d4e150ea0ed1a29e8ed49a500e1c77
│   │   ├── 261e9d1f711e10945f1ad40d9ee5a5d892d4e150ea0ed1a29e8ed49a500e1c77-json.log # log file
│   │   ├── config.json # The config file of the container, such as state, image, memory, cpu, networking, mount
│   │   ├── hostconfig.json # The host config for this container, such as host mount, port maping, volume from other container
│   │   ├── hostname # hostname
│   │   ├── hosts # host file for this container
│   │   ├── resolv.conf # DNS settings for this container
│   │   └── resolv.conf.hash
│   └── fa3339efba1560a1c0b7c140a1c091f68258e9a664d661505a5b1d5b5773d8ec
│       ├── config.json
│       ├── fa3339efba1560a1c0b7c140a1c091f68258e9a664d661505a5b1d5b5773d8ec-json.log
│       ├── hostconfig.json
│       ├── hostname
│       ├── hosts
│       ├── resolv.conf
│       └── resolv.conf.hash
├── devicemapper # Two types of backend storage DM (devicemapper) and AUFS (advanced multi layered unification filesystem) . RedHat/CentOS/Fedora uses DM as default storage driver. DM supports thin provisioning, loopback mounted sparse file. (http://developerblog.redhat.com/2014/09/30/overview-storage-scalability-docker/, https://github.com/docker/docker/blob/master/daemon/graphdriver/devmapper/README.md, http://www.projectatomic.io/docs/filesystems/)
│   ├── devicemapper
│   │   ├── data # Data loop file
│   │   └── metadata # Metadata loop file
│   ├── metadata
│   │   ├── 10acc31def5d6f249b548e01e8ffbaccfd61af0240c17315a7ad393d022c5ca2
│   │   ├── 261e9d1f711e10945f1ad40d9ee5a5d892d4e150ea0ed1a29e8ed49a500e1c77
│   │   ├── 261e9d1f711e10945f1ad40d9ee5a5d892d4e150ea0ed1a29e8ed49a500e1c77-init
│   │   ├── 3310574481b22e66d4beead0e0915a5d090c742724107cb59ae6470573830210
│   │   ├── base
│   │   ├── deviceset-metadata
│   │   ├── fa3339efba1560a1c0b7c140a1c091f68258e9a664d661505a5b1d5b5773d8ec
│   │   ├── fa3339efba1560a1c0b7c140a1c091f68258e9a664d661505a5b1d5b5773d8ec-init
│   │   └── transaction-metadata
│   └── mnt
│       ├── 10acc31def5d6f249b548e01e8ffbaccfd61af0240c17315a7ad393d022c5ca2
│       ├── 261e9d1f711e10945f1ad40d9ee5a5d892d4e150ea0ed1a29e8ed49a500e1c77
│       ├── 261e9d1f711e10945f1ad40d9ee5a5d892d4e150ea0ed1a29e8ed49a500e1c77-init
│       ├── 3310574481b22e66d4beead0e0915a5d090c742724107cb59ae6470573830210
│       ├── fa3339efba1560a1c0b7c140a1c091f68258e9a664d661505a5b1d5b5773d8ec
│       └── fa3339efba1560a1c0b7c140a1c091f68258e9a664d661505a5b1d5b5773d8ec-init
├── execdriver # Running container
│   └── native
│       ├── 261e9d1f711e10945f1ad40d9ee5a5d892d4e150ea0ed1a29e8ed49a500e1c77
│       └── fa3339efba1560a1c0b7c140a1c091f68258e9a664d661505a5b1d5b5773d8ec
├── graph # Where Images are saved
│   ├── 10acc31def5d6f249b548e01e8ffbaccfd61af0240c17315a7ad393d022c5ca2
│   │   ├── json
│   │   └── layersize
│   ├── 3310574481b22e66d4beead0e0915a5d090c742724107cb59ae6470573830210
│   │   ├── json
│   │   └── layersize
│   └── _tmp
├── init # docker init binary versions
│   ├── dockerinit-1.3.2
│   └── dockerinit-1.5.0
├── linkgraph.db # SQLite db file that is used for keeping the links between containers
├── repositories-devicemapper # Info for images
├── tmp
├── trust #???
│   └── official.json
└── volumes # Randomly created volumes on host
├── 150967e6f9f81f50a73f56d60fcbd4b189cbf09ee7f7df41f61438d40d2a5057
│   └── config.json
├── a46bf00d73c6c0d79c6390cc52b9383e7779c0695b46d3a152f6b98dd0a69349
│   └── config.json
├── d6cbe5421c0d76c05c76bb56d72ca06f7d1e65813f4a02b9d8a440763006af39
│   └── config.json
└── f1cc2170872cd2592d6847db422fbf474c30fc79255c8da883ccbec5b2523f33
└── config.json

Advertisements

One thought on “Understanding docker directory structure

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s