Book Image

Learning Docker

By : Pethuru Raj, Jeeva S. Chelladhurai, Vinod Singh, Vinod kumar Singh, Jeeva Chelladhurai, Pethuru Raj Chelliah
Book Image

Learning Docker

By: Pethuru Raj, Jeeva S. Chelladhurai, Vinod Singh, Vinod kumar Singh, Jeeva Chelladhurai, Pethuru Raj Chelliah

Overview of this book

Table of Contents (18 chapters)
Learning Docker
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

The data volume


The data volume is the fundamental building block of data sharing in the Docker environment. Before getting into the details of data sharing, it is imperative to gain a good understanding of the Data Volume concept. Until now, all the files that we created in an image or a container are part and parcel of the Union filesystem. However, the data volume is part of the Docker host filesystem, and it simply gets mounted inside the container.

A data volume can be inscribed in a Docker image using the VOLUME instruction of the Dockerfile. Also, it can be prescribed during the launch of a container using the -v option of the docker run subcommand. Here, in the following example, the implication of the VOLUME instruction in the Dockerfile is illustrated in detail, in the following steps:

  1. Create a very simple Dockerfile with the instruction of the base image (ubuntu:14.04) and the data volume (/MountPointDemo):

    FROM ubuntu:14.04
    VOLUME /MountPointDemo
  2. Build the image with the name mount...