Use volumes
Use volumes
Volumes are the preferred mechanism for persisting data generated by and used by Docker containers. While bind mounts are dependent on the directory structure of the host machine, volumes are completely managed by Docker. Volumes have several advantages over bind mounts:
- Volumes are easier to back up or migrate than bind mounts.
- You can manage volumes using Docker CLI commands or the Docker API.
- Volumes work on both Linux and Windows containers.
- Volumes can be more safely shared among multiple containers.
- Volume drivers let you store volumes on remote hosts or cloud providers, to encrypt the contents of volumes, or to add other functionality.
- New volumes can have their content pre-populated by a container.
In addition, volumes are often a better choice than persisting data in a container’s writable layer, because a volume does not increase the size of the containers using it, and the volume’s contents exist outside the lifecycle of a given container.
If your container generates non-persistent state data, consider using a tmpfs mount to avoid storing the data anywhere permanently, and to increase the container’s performance by avoiding writing into the container’s writable layer.
Volumes use rprivate
bind propagation, and bind propagation is not configurable for volumes.
相关文章
- [Typescript + React] Tip: Use generics in React to make dynamic and flexible components
- [CSS] Use grid-template to make your CSS Grid declarations more readable
- [TypeStyle] Use TypeStyle keyframes to create CSS animations
- [React] Use React.cloneElement to Extend Functionality of Children Components
- [React] Use React Context to Manage Application State Through Routes
- [Debug] Use Snippets to Store Behaviors in Chrome DevTools
- [Javascript] Use Number() to convert to Number if possilbe
- [Node.js] Use "prestart" in scripts
- [Python Test] Use pytest fixtures to reduce duplicated code across unit tests
- [React] Use Jest's Snapshot Testing Feature
- Our form can use the Web Service now
- 【异常】前端提示Cannot use [chunkhash] or [contenthash] for chunk in ‘[name].[chunkhash].js‘