I am writing a Dockerfile for setting up an image for testing a web application. I am basing it on the tutum/lamp image (https://github.com/tutumcloud/tutum-docker-lamp/blob
You can't really undeclare a volume, but you can build your own version of the original image by modifying its dockerfile.
Not possible to change an existing container, so you have two options:
Create a container that creates a data volume reference:
docker run -it --name dbvol -v /var/lib/mysql ubuntu env
This can then be used when running the mysql database to persist the data:
docker run -d --volumes-from dbvol -p 3306:3306 tutum/mysql:5.6
The data persists as long as the "dbvol" container exists. It can be deleted at any stage:
docker rm dbvol
Reference:
There has been no change to this problem space in years, so I have created docker-copyedit as a workaround to "undeclare" a volume by editing the metadata of a downloaded image.