Docker Community Forums

Share and learn in the Docker community.

Undo previously declared volume

VOLUME behavior is to:

Note: If any build steps change the data within the volume after it has been declared, those changes will be discarded. [1]

I would like to reuse an upstream image, that declared a VOLUME but change some data in there, Is there a way to “undo” the volume declaration so my changes are not ignored? If not, maybe can this be transformed in a feature request?

Thanks.

[1] - https://docs.docker.com/engine/reference/builder/#volume

Usually VOLUME directories are declared as so for good reason (e.g., /var/lib/postgresql so that DB data is written to the backing filesystem, not weird union filesystem like AUFS), you might want to consider building your own image from scratch if it’s truly that important to undo the volume for your use case.