I have an image derived from the Postgres official image, whose Dockerfile includes the following:
VOLUME /var/lib/postgresql/data
I'd like to create my own image based on this official image, but I don't want it to reference any volume. I'd like the Postgres data to be inside my image.
Any ideas please?
You can't undo the VOLUME
directive.
See this open issue on github: Reset properties inherited from parent image #3465
There are some solutions, based on answers of theses questions:
You can copy the base image and remove the VOLUME
manually.
A workaround, see docker-copyedit. The script will docker save
and image into an archive to modify its metadata and docker load
it back into an image.
If you don't care about the volume and just want to put the data in the image, you'll have to use another location for the data and you can use use the environment variable PGDATA
to define the new location.