|
...
|
...
|
@@ -80,15 +80,15 @@ it.
|
|
80
|
80
|
|
|
81
|
81
|
Let's create a new named container with a volume to share.
|
|
82
|
82
|
|
|
83
|
|
- $ docker run -d -v /dbdata --name dbdata training/postgres
|
|
|
83
|
+ $ sudo docker run -d -v /dbdata --name dbdata training/postgres
|
|
84
|
84
|
|
|
85
|
85
|
You can then use the `--volumes-from` flag to mount the `/dbdata` volume in another container.
|
|
86
|
86
|
|
|
87
|
|
- $ docker run -d --volumes-from dbdata --name db1 training/postgres
|
|
|
87
|
+ $ sudo docker run -d --volumes-from dbdata --name db1 training/postgres
|
|
88
|
88
|
|
|
89
|
89
|
And another:
|
|
90
|
90
|
|
|
91
|
|
- $ docker run -d --volumes-from dbdata --name db2 training/postgres
|
|
|
91
|
+ $ sudo docker run -d --volumes-from dbdata --name db2 training/postgres
|
|
92
|
92
|
|
|
93
|
93
|
You can use multiple `--volumes-from` parameters to bring together multiple data
|
|
94
|
94
|
volumes from multiple containers.
|
|
...
|
...
|
@@ -96,7 +96,7 @@ volumes from multiple containers.
|
|
96
|
96
|
You can also extend the chain by mounting the volume that came from the
|
|
97
|
97
|
`dbdata` container in yet another container via the `db1` or `db2` containers.
|
|
98
|
98
|
|
|
99
|
|
- $ docker run -d --name db3 --volumes-from db1 training/postgres
|
|
|
99
|
+ $ sudo docker run -d --name db3 --volumes-from db1 training/postgres
|
|
100
|
100
|
|
|
101
|
101
|
If you remove containers that mount volumes, including the initial `dbdata`
|
|
102
|
102
|
container, or the subsequent containers `db1` and `db2`, the volumes will not
|