search

Home  >  Q&A  >  body text

docker删除images中定义好的Volumes

docker的image中已经定义好了一系列volume目录。
由于几个目录位置并不合理所以需要删除volume重新创建。
但是不知道怎么删除volume并提交到镜像。

volume的创建方式: docker run -v /xxx [image] /bin/bash

由于经验不足,没有预留Dockerfile和对应的tag,只能再当前镜像内做修改……

天蓬老师天蓬老师2774 days ago678

reply all(1)I'll reply

  • 習慣沉默

    習慣沉默2017-04-25 09:04:05

    First, check whether the image is yours.
    If so, modify the Dockerfile to delete the unnecessary data volumes and rebuild the image.
    If not, the person who made the mirror must have his own intention in setting the data volume here. Why should you delete the data volume he set? If you don't want to use it, just create a new one and use it yourself.

    If the data volume is created by docker run -v, delete the container and re-create it without this data volume.

    reply
    0
  • Cancelreply