How to remove a volume in a Dockerfile

一笑奈何 提交于 2019-12-24 07:39:25

问题


I'm experiencing the same problem as found here: mkdir .ssh in a Dockerfile, folder is not there?

I'm wondering if there is a way for my dockerfile to remove a volume declared by its parent?

My reasoning for this is that; the volume was declared to mount to an external database, the image I'm creating is for testing purposes and contains the data present for the volume internally. Ideally I don't want to have to populate this in my entry point as it's an expensive operation.


回答1:


See also How to remove configure volumes in docker images

Actually I did have a very similar use case in using an image from production that would be modified for testing. The only chance is to modify the metadata of the parent image. As I need to that regulary, I have created a little script for that, have a look at docker-copyedit if that can help you.



来源:https://stackoverflow.com/questions/49984318/how-to-remove-a-volume-in-a-dockerfile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!