When non-persistent container produces some data and it want data to store persistently then data volume comes into picture. Using data volume mechanism, directory created within the docker is mounted in host so that even after container stops data would be persistent. This is achieved by running command as following:
$docker run -it -v /docker_directory --name
When two or more containers want to share data then docker volume container is the option to achieve it.
To create docker volume container is very easy. Please follow the steps as below:
1. First create a data volume for a container by using the command as above.
2. While creating another container use the --volumes-from option. By using this option, when another container comes up it can use the same volume which is already being used by first container. The command syntax would be as following:
$docker run -it --volumes-from --name
Hope, this will help you to give initial insight.