Docker Community Forums

Share and learn in the Docker community.

Cannot map a directory on my computer to the docker container

I have been running Docker Desktop on Windows 10 Home. I’m trying to map my Downloads folder to the folder “data” in my Docker container built for a streamlit app. The directory structure in the docker image is as follows:
app
I_ data
I_ python file

The app (before dockerising) is running fine when I run it on my machine. However, when I run the Docker imaeg I built for it using the following command:

docker run -v C:/Users/hp/Downloads:/data/ -p 8501:8501 okkularimages/app

The app is not able to access the images by mapping the Downloads folder to the data folder.
I’m new to Docker, and any guidance is highly appreciated.

here is my Dockerfile:

FROM python:3.7.9
WORKDIR /app
ADD ./requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
COPY . /app
EXPOSE 8501
ENTRYPOINT ["streamlit","run"]
CMD ["app.py"]

What exactly does that mean?

…along with:

Just to be sure, as you also have a data folder within your app folder: did you indeed mean to mount it to /data rather than /app/data?

I meant that the app is supposed to show the images, but it’s not able to do that because it’s not able to access them after I map the Downloads folder to the data folder.
I’ve tried mounting /app/data as well, but it had the same result

So, for example, no error message thrown by the app to give more details? Just “not able to access” is just too vague to help you.

Sounds like trial and error? Where does the app expect the images?

I’d look into docker exec to connect to the running container and see what’s available in the mounted volume.