In this recipe, we will learn how to mount volumes into a container. Before we start writing tasks, let's take a look at Docker's storage offering. Docker provides a writable layer that is tightly coupled with a host. Data written on the writable layer of a container will be inaccessible once the container has stopped, and will be lost when the container is deleted.
Docker provides three ways of mounting data into a container:
- Volumes are the most commonly used mounts for Docker containers. They exist on a specific path of a host's filesystem, which cannot be modified by another process.
- Bind mounts can be present anywhere in the filesystem of the host, including files or directories, and they can also be modified by another process running outside the container.
- Tmpfs mounts are hosted in memory storage, which never goes into a...