Container station: sharing common files
In this page we're going to create a link from in a container/image to the Host.
Inside the container is "/app/media" and bind it to a share on the QNAP host system.
Context
While it's convenient to spin up a new Docker image, or republish one. You'll soon come into a situation where you want to share resources over different containers. Or you realize there is data in the container, that you want to retrieve or need to copy over when you spin up a new container... Which soon becomes a daunting task and a chore, which is prone to making mistakes while doing this heavy manual work.
The most convenient way, I have found, is to bind a folder in the container with the host system.
And share this drive in the private network - so it becomes possible to edit the files easily. And share, for example a folder with images and videos, over different containers.
Configuration
1) Create your folders and optionally share them. (I would suggest to create a folder per project and also split up between your Test and Production.
2) Create a new container
3) While configuring, go to Advanced Settings -> Storage -> Bind Mount Host Path
4) Write your mapping. In my case I have a share at /DOCKERMEDIA
How to access the files
Commandline:
When I open a shell on my QNAP - it will be listed under the path /share/DOCKERMEDIA
From the application in the docker:
In a docker application, you would configure it as below. When you compile the solution for ISS Express, it will be on your local system.
But when you publish it to a docker, it will look at the path /app/media - which is now linked to the QNAP directory.
Open window explorer and access the share:
\\192.168.111.222\dockermedia\
Ofcourse, this isn't automatically shared and we assume you've set up the share in ControlPanel.