Docker-compose volume storing image
In my Web API I receive images. These images should be stored, prefferable in my local directory. My project uses docker (compose).
I managed to use a volume where the images are getting stored in a folder called
unfiltered_images
in the docker container.
However, the saved images do not appear into my specified folder on my d-drive.
docker-compose
In the future. I want to deploy this app onto my Raspberry Pi where an external hard disk will be used to store the images.3 Replies
Not sure I'll be able to follow up if you answer, but just to get the obvious things out of the way so that it may help others:
- if you
docker exec -it apitest.api ls /unfiltered_images
can you see the actual files?
- if you docker exec -it apitest.api touch /unfiltered_images/chicken.png
, can you then see the file?
EDIT to add: the indentation in the compose file seems to be a little off for the volume, yaml can get a little weird, I'm guessing it should give you an error but it's probably worth it to fix it and try again, unless it's just a copy-paste gone wrong.
EDIT on top of the edit: if your app is running as user app
, you could add -u app
before -it
in those docker exec
commands, otherwise you're likely to execute them as root, I think.hi there. thanks for your reply. for the creation of my docker containers i fully rely on the
build docker-compose
function in Visual Studio.
I deleted the unfiltered_images
folder, ran the application again and posted a single image.
in my docker-desktop i can see the the files in the map (see screenshot). This folder also becomes present in my project structure in Visual Studio.The images do get added to the container directory. But what i want to achieve is that the images also get stored in my d-drive.
I see now that the host folder does get created, but there are no files into the folder being written.
oh my god I FANALLY HAVE IT 😠.
This is the volume:
This is the storage path in my code: