In the previous recipe, we used a named volume to persist application data. We also learned that named volumes can be used to share data between containers. In this recipe, we will use bind mounting to mount a Docker host directory to a container and then share data between the Docker host and container using that mount point.
Sharing data between the host and the container
Getting ready
Before we begin, ensure that the Docker daemon is running.
How to do it...
Perform the following steps:
-
Let's begin by creating a new directory called data_share in our home directory...