Docker - How to access a volume not attached to a container?

前端 未结 3 1644
终归单人心
终归单人心 2021-01-13 09:09

I have (had) a data container which has a volume used by other containers (--volumes-from).

The data container has accidentally been removed.

Thankfully the

3条回答
  •  终归单人心
    2021-01-13 09:31

    Is there any way can re run the data container and point it BACK to this volume?

    Sure, I detailed it in "How to recover data from a deleted Docker container? How to reconnect it to the data?"

    You need to create a new container with the same VOLUME (but its path /var/lib/docker/volumes/... would be empty or with an initial content)

    Then you move your legacy volume to the path of the volume of the new container.

    More generally, whenever I start a data volume container, I register its volume path in a file (to reuse that path later if my container is accidentally removed)

提交回复
热议问题