top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Docker: What is the difference between Data Volume and Data Volume Containers ?

+1 vote
480 views
Docker: What is the difference between Data Volume and Data Volume Containers ?
posted Aug 8, 2017 by Vikram Singh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

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.

answer Aug 20, 2017 by Harshita
Similar Questions
0 votes

What is the difference between following commands:
$docker run -d
$docker run -it -d

How the option "-it" make the difference ?

+1 vote

Is it possible multiple docker containers each one running web server and listening on the same port, mapped to the same host machine port ? One possible solution to multiple IPs at the host machine and the port exposed by each container is mapped to different ip and standard port 80. This solution would not be feasible in case number of containers increases in the same host and a new IP need to be assigned at host machine for each container.

...