I'm trying to save data from my docker app to a host folder. My dockerfile is:
FROM python:3 # set a directory for the app WORKDIR /usr/src/app # copy all the files to the container COPY . . # install dependencies RUN pip install --no-cache-dir -r requirements.txt EXPOSE 8050 CMD ["python", "./app.py"] I then build the image:
docker build <path> -t <tag> And then run:
docker run -p 8050:8050 <tag> In order to save the output from the docker app, which I was trying to do like this
pd.DataFrame(rows).to_excel('S:/Folder1/Folder2/Folder3/file.xlsx', index=False) I have to mount the volume, within Docker Settings>Resources>File Sharing I've added the directory 'S:/Folder1/Folder2/Folder3/' so that it can be mounted into Docker containers.
And then I tried to run the image:
docker run -p 8050:8050 -v "s:/folder1/folder2/folder3/":"/data" <tag> this pop ups a window "Docker wants to access to C\dc\Shared\folder1\folder2\folder3" And I can choose to share or cancel, after selecting share, folder 3 is created in the right location but I get the error:
docker: Error response from daemon: error while creating mount source path '/host_mnt/uC/dc/Shared/folder1/folder2/folder3/': mkdir /host_mnt/uC: operation not permitted. If I try a location on my C: drive this works without problems, it's just the shared drive that is giving me problems.
What is the right way to mount the volume so I can then save to that folder? Thank you
C:\Development\tempBuilt image there with your commands. Started it's shell withdocker run -it -p 8050:8050 -v "C:\Development\temp":"/data" test bashThen I was able to write new fileecho "Testing" > /data/testingto mounted directory. So does your Python code.