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

Analysis of tmpfs mounts example of Docker data Storage

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces the relevant knowledge of "tmpfs mounts case Analysis of Docker data Storage". The editor shows you the operation process through the actual case. The operation method is simple, fast and practical. I hope this article "tmpfs mounts case Analysis of Docker data Storage" can help you solve the problem.

Tmpfs mounts

The volumes and bind mounts modes enable us to share files between the host and the container so that we can persist the data to the host to avoid the problem of data loss after the container is stopped when writing to the container storage layer.

If you use linux to run docker, there is another solution to avoid writing data to the container storage layer: tmpfs mounts.

Tmpfs mounts, as its name implies, is a non-persistent data store. It only stores the data in the host's memory, and once the container stops running, the tmpfs mounts will be removed, resulting in data loss.

The use of tmpfs mounts

We can use tmpfs mounts when running the container by specifying either the-- tmpfs parameter or the-- mount parameter:

$docker run-d\-it\-- name tmptest\-- mount type=tmpfs,destination=/app\ nginx:latest$ docker run-d\-it\-- name tmptest\-- tmpfs / app\ nginx:latest

You cannot specify any other options using the-- tmpfs parameter and cannot be used with swarm service.

Use the docker container inspect tmptest command, and then look at the mounts section to see:

"tmpfs": {"/ app": ""}

Tmpfs mounts optional option

An example:

Docker run-d\-it\-- name tmptest\-- mount type=tmpfs,destination=/app,tmpfs-mode=1770\ nginx:latest 's content on "tmpfs mounts instance Analysis of Docker data Storage" ends here. Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

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

Development

Wechat

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

12
Report