flyer
flyer

Reputation: 9816

How to automatically remove container data from the host when rm the container?

I find that if running docker run -d -v /HOST/PATH:/CONTAINER/PATH IMAGE to mount data volumes, the data still remains on the host after deleting the container.
Is it designed to do so? Is there a way to automatically remove container data from the host when deleting the container?

Upvotes: 0

Views: 235

Answers (1)

zigarn
zigarn

Reputation: 11595

Manage data in containers:

Data volumes are designed to persist data, independent of the container’s lifecycle.

If you don't want the data to persist on the host, don't use volumes.

Upvotes: 1

Related Questions