Sowndarya K
Sowndarya K

Reputation: 419

Docker mount namespace to share between containers

How the mount namespace using container's id is utilized for sharing files in other containers even after exiting from the original container?

Upvotes: 4

Views: 1791

Answers (1)

VonC
VonC

Reputation: 1327754

This is called a data colume container: see "Creating and mounting a data volume container"

$ docker create -v /dbdata --name dbdata training/postgres /bin/true
$ docker run -d --volumes-from dbdata --name db1 training/postgres
$ docker run -d --volumes-from dbdata --name db2 training/postgres

Here, even if the container db1 exits, db2 has still access to the shared voume dbdata.

dbdata is a data volume container that you don't "run" (there is no process running in it, only a shared volume of data); you "create" it only. (and you don't "exit" it either, since you never ran it)

Upvotes: 2

Related Questions