Nathan Whitehead
Nathan Whitehead

Reputation: 2012

Export tar of changed files in container

I'm running containers using Docker. I'm making snapshots of the state of the container's filesystem as a diff from the container's base using docker commit. I would like to also snapshot in a tar file that stores just the files that have changed for the commit.

Using docker diff I can see which files have changed. Using docker export I get all files in the container in a tar. How do I get a tar file of just the changed files from the base? Ideally I could also exclude directories (like /dev).

Upvotes: 4

Views: 1554

Answers (1)

jpetazzo
jpetazzo

Reputation: 15511

That tarball is exactly what is stored within the Docker registry!

If the snapshot that you are interested in is already in a registry, you can use the Docker Registry Protocol to retrieve it.

If it is present only locally, you can look in /var/lib/docker/graph/<imageid>/layer: the changed files are here. Note that this location might change in Docker 0.7, since it is currently here as an artifact of the AUFS implementation.

Upvotes: 4

Related Questions