- Docker and Kubernetes for Java Developers
- Jaroslaw Krochmalski
- 316字
- 2021-07-02 18:44:54
Persistent storage
As you remember from Chapter 1, Introduction to Docker, the Docker container filesystem is kind of temporary by default. If you start up a Docker image (that is, run the container), you'll end up with a read-write layer on top of the layers stack. You can create, modify, and delete files as you wish; if you commit the changes back into the image, they will become persisted. This is a great feature if you want to create a complete setup of your application in the image, altogether with all its environment. But, this is not very convenient when it comes to storing and retrieving data. The best option would be to separate the container life cycle and your application from the data. Ideally, you would probably want to keep these separate, so that the data generated (or being used) by your application is not destroyed or tied to the container life cycle and can thus be reused.
The perfect example would be a web application server: the Docker image contains web server software, the same as Tomcat for example, with your Java application deployed, configured, and ready to use. But, the data the server will be using should be separated from the image. This is done via volumes, which we will focus on in this part of the chapter. Volumes are not part of the union filesystem, and so the write operations are instant and as fast as possible, there is no need to commit any changes.
There are three main use cases for Docker data volumes:
- To share data between the host filesystem and the Docker container
- To keep data when a container is removed
- To share data with other Docker containers
Let's begin with a list of volume-related commands at our disposal.
- Getting started with Google Guava
- 小程序?qū)崙?zhàn)視頻課:微信小程序開發(fā)全案精講
- Java從入門到精通(第4版)
- NativeScript for Angular Mobile Development
- Java游戲服務(wù)器架構(gòu)實戰(zhàn)
- Python金融數(shù)據(jù)分析
- 精通網(wǎng)絡(luò)視頻核心開發(fā)技術(shù)
- 從0到1:Python數(shù)據(jù)分析
- Oracle Exadata專家手冊
- Android程序設(shè)計基礎(chǔ)
- Scratch趣味編程:陪孩子像搭積木一樣學(xué)編程
- 算法設(shè)計與分析:基于C++編程語言的描述
- 算法秘籍
- 零基礎(chǔ)學(xué)Java第2版
- 從零開始學(xué)Unity游戲開發(fā):場景+角色+腳本+交互+體驗+效果+發(fā)布