we are working in asp.net cor 2.2 application. we main our application attachments with an application root folder. we saved the file path in the backend. whenever we want attachment we used that attachment path. now we moved to the docker image and deployed it in openshift. now we can't get our attachments. I don't know the way how we get the folder from a docker image
Asked
Active
Viewed 128 times
-1
-
Why can't you get your attachments? The code in the container still has access to its filesystem. – OneCricketeer Dec 14 '19 at 10:17
-
but how we get the file from container.i have my attachment path if I access it does not return my attachment – arul pushpam Dec 21 '19 at 09:25
-
Well, in .NET you could return a binary file as an HTTP response, and just download that like most other websites allow you to do. It's not clear how you were getting attachments before... Are you familiar at all with Docker volumes? – OneCricketeer Dec 21 '19 at 10:00
-
I am not much familiar with docker volume. my real-time problem is I deployed site in openshift container.in my local deployment I saved my attachment in root folder+attachment path like ww.mysite.com/attachment/image.png.whenever i want attachment I get it from my folder path. that same functionality I expect in open shift.but i don't know the way – arul pushpam Dec 21 '19 at 11:52
-
11) Your container can run on any machine, so putting files in any folder on those machines will not be persisted unless you understand Kubernetes PersistentVolumeClaims 2) I don't see how openshift is completely relevant, though. You should be able to run the Docker container locally and you'd have the same question, right? So, what's stopping you from making a route in the application to [serve back `attachment/{file}` for downloads](https://stackoverflow.com/questions/5826649) ? Or are you able to refactor your code to store the files outside of the actual application? – OneCricketeer Dec 21 '19 at 17:32
1 Answers
0
It's not clear what your deployment configuration looks like, but sounds like you want persistent storage.
Without this, as soon as one container restarts, any files that were created within it will be lost. Also, if you run multiple pods or scale up the application to handle increased requests, for example, then you have multiple folders you'll need to consider, and not all would share the same files
With it, you define the path within the container from which an external location will be mounted, and files will be synced across both locations

OneCricketeer
- 179,855
- 19
- 132
- 245