How to remove configure volumes in docker images

前端 未结 3 512
盖世英雄少女心
盖世英雄少女心 2020-12-21 00:12

I use docker run -it -v /xx1 -v /xx2 [image] /bin/bash to create a container.

Then commit to image and push to docker hub.

use docker insp

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-21 00:18

    There is a workaround in that you can docker save image1 -o archive.tar, editing the metadata json file, and docker import -i archive.tar. That way the history and all the other metadata is preserved.

    To help with save/unpack/edit/load I have created a little script, have a look at docker-copyedit. Specifically for your question you would execute

    ./docker-copyedit.py from [image] into [image2] remove volume /xx1
    

提交回复
热议问题