Inspect docker container FS changes from host

I’ve started a docker container and I’ve modified a file. At some point later I’d like to inspect this change from the docker host. Now I use docker cp to export the file, inspect it, delete it. But this multistep copy-read-delete process seems like over kill if I just want to read a file.

Is there a better way to inspect filesystem changes in a docker container?

  • Efficient development flow for Cloud Foundry
  • boot2docker equivalent of docker exec
  • Variables set in .env is not present inside the docker container
  • ELK docker access via localhost
  • How to keep track of pip installed packages on one docker container to use them in another
  • Docker container running but browser refuse to connect
  • I need more info than docker diff is showing.

  • How to configure rabbitmq.config inside Docker containers?
  • Docker doesn't install correct on Mac
  • install additional python package on docker
  • OpenShift V3: understanding the process with Docker
  • why vagrant 1.6 + docker keep asking password for ssh connection
  • Mount specific EBS volume to Docker under AWS beanstalk
  • 2 Solutions collect form web for “Inspect docker container FS changes from host”

    You can find the filesystem of a running container the Docker data directory, usually /var/lib/docker/. The specific location varies depending on which storage driver is used. In the case of AUFS, the location is `/var/lib/docker/aufs/mnt/${CONTAINER_ID}/.

    $ HELLO_WORLD=$(docker run -d  ubuntu:12.04 /bin/sh -c "while true; do echo Hello world; sleep 1; done")
    $ docker ps
    CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS              PORTS               NAMES
    2524e196adf0        ubuntu:12.04        /bin/sh -c while tru   4 seconds ago       Up 3     seconds                            naughty_brown
    $ echo $HELLO_WORLD
    $ sudo ls /var/lib/docker/aufs/mnt/${HELLO_WORLD}/
    bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  selinux  srv  sys  tmp  usr  var

    This is not a general solution, but in special cases, you can use mounted volumes:

    Start the container with volume:

    sudo docker run -v /host_path/shared:/shared <container>

    Store files you want to inspect in container dir /shared or copy & ln files to /shared and make needed files symbolic links to files stored in /shared.

    cp /mydir/myfile /shared/myfile
    ln -s -f /shared/myfile /mydir/myfile

    Then you can inspect these files directly in /host_path/shared.

    Note: You cannot symbolic-link special files like /etc/passwd, /etc/hostname etc.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.