Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does docker check what volumes the container has?

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to check the volume of the container by docker". Friends who are interested may wish to take a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to check the volume of the container by docker".

View all data volumes

Docker volume ls

Create a data volume

Docker volume create [Volume name]

To view information about the specified data volume

Docker volume inspect my-vol

Start a container that mounts the data volume

Docker run-d-P-- name web-- mount source=my-vol,target=/webapp training/webapp python app.py

Delete data Volum

Docker volume rm my-vol

Clean up unowned data volum

Docker volume prune

Sometimes, if we deploy related containers to the same host and want data to be shared between containers, we should create a named data volume container and mount it to other containers. Such as:

Docker run-d-v / dbdata-- name dbdata taining/postgres

The / dbdata data volume is then mounted in other containers via-volumes-from.

Docker run-d-volumes-from dbdata-- name db1 taining/postgresdocker run-d-- volumes-from dbdata-- name db2 taining/postgres

You can mount multiple volumes from multiple containers using multiple-volumes-from parameters at the same time.

At this point, I believe you have a deeper understanding of "how to check the volume of the container by docker". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report