James Porter
James Porter

Reputation: 1933

Is it possible to commit only a subset of the changes to a docker image?

I am considering using Docker for a project, but I have one question I have not been able to find an answer to in the docs or anywhere else: is it possible to commit only a subset of the changes I make to an image?

Let's say I start a container, make a bunch of changes to the filesystem, get my thing working well and then want to commit them to a new base image. However, I only want a small subset of the changes that were actually made (maybe some of them were to log files, or other things that are unimportant). Does docker commit allow to specify that I only want changes, say, under some part of the filesystem to be committed?

Upvotes: 2

Views: 627

Answers (1)

qkrijger
qkrijger

Reputation: 27246

You would just first remove the unnessecary files. To my knowledge, partial commits are not supported. If you want to do this, using docker diff is really handy. You can easily see what the file system changes are that way. You can even run that against a running container.

Upvotes: 3

Related Questions