Docker 101 : Accessing a container's storage from another container
Access to the volume of a container from a different container:
We use the below command, to first create a "vol-deb" volume for our containers on our host's storage:
We then create a file "file.txt" in the debian container's UFS filesystem - in the "/opt" directory - by running the below commands inside our container:
Even if we exit our container or remove it, the volume "vol-deb" would still be accessible.
The volume "vol-deb", could also be used from another container using the below command:
The above command runs another container - ed22087d7986 - using a debian image and the volume "vol-deb".
We create another file - file1.txt -, we also notice that the file - file.txt - we created earlier in the - 3484c609bd8e - container is also there.