Docker Community Forums

Share and learn in the Docker community.

Disable all volumes

Having an arbitrary docker image is it possible to disable all the volumes it declares in the Dockerfile?
Or may be it is possible to disable/remove volumes after the container is created (not run yet)?

My expectation is that such a container should work normally, but all the data that was supposed to be stored in those volumes will just be stored in the writable container layer as if those volumes have never been declared.

I am aware of the https://github.com/gdraheim/docker-copyedit project that claims it is capable of removing all the “VOLUME” definitions from the image, but is there a more elegant way to do so via Docker API or smth else?
May be i could drop some specific privileges for a container to make it impossible to mount anything?