Docker named volumes vs DOC (data-only-containers)

前端 未结 1 645
伪装坚强ぢ
伪装坚强ぢ 2020-12-14 08:22

Up to recent version of Docker (v1.10), we were thought that we can use DOC: data-only containers. So I would create such DOC (based on e.g. busybox) and use

相关标签:
1条回答
  • 2020-12-14 09:08

    Can we replace DOC with named containers?

    In many cases, yes, named containers will be a better option.

    How long volume is persisted? What if I remove the container that is using it?

    If you remove the container, the volume will still be there. The only way to remove the volume is to use docker-compose down -v or docker volume rm <volume name>.

    How can we e.g. backup now? Previously, I could docker run --rm --volumes-from es-data ... and then tar it.

    Instead of --volumes-from, you can use --volume=<volume name>.

    Note that volumes created by docker-compose are always prefixed with the project name, so if you use it with a docker command the full name is actually <project_name>_es-data.

    0 讨论(0)
提交回复
热议问题