Getting Started with Containerization
上QQ阅读APP看书,第一时间看更新

Data Volumes and System Management

In the last chapter, we learned how to build and share our own container images. Particular focus was put on how to build images that are as small as possible by only containing artifacts that are really needed by the containerized application.

In this chapter, we are going to learn how we can work with stateful containers, that is containers that consume and produce data. We will also learn how to keep our Docker environment clean and free from unused resources. Last but not least, we will be looking into the stream of events that a Docker engine is producing.

Here is a list of the topics we're going to discuss:

  • Creating and mounting data volumes
  • Sharing data between containers
  • Using host volumes
  • Defining volumes in images
  • Obtaining exhaustive Docker system information
  • Listing resource consumption
  • Pruning unused resources
  • Consuming Docker system events

After working through this chapter, you will be able to:

  • Create, delete, and list data volumes
  • Mount an existing data volume into a container
  • Create durable data from within a container using a data volume
  • Share data between multiple containers using data volumes
  • Mount any host folder into a container using data volumes
  • Define the access mode (read/write or read-only) for a container when accessing data in a data volume
  • List the amount of space consumed by Docker resources on a given host, such as images, containers, and volumes
  • Free your system from unused Docker resources, such as containers, images, and volumes
  • Display Docker system events in a console in real time