Hello all, new to Docker here. Trying to run a container, but keep getting the following error message, even though I have followed the steps outlined. I’m afraid I don’t understand what the problem is.
Failed to run image. (HTTP code 500) server error - Mounts denied: The path /media is not shared from the host and is not known to Docker. You can configure shared paths from Docker → Preferences… → Resources → File Sharing.
Docker Desktiop runs a virtual machine. When you bind mount a folder from the host, that first has to be shared with the virtual machine. Go to the Docker Desktop settings, Resources and there File Sharing, and there share /media.
I ended up solving this on my own. The UI was not clear to me, in that I did not click the “+” after entering the volume info while running the container for the first time. I would enter the info and click run, because I did not need to add a second volume.
shouldn’t this be able to be done as a setting in a dockerfile? I had this same issue and fixed it with the docker desktop solution but can’t this happen on a cloud hosted system where the Desktop may not be installed? I would think it should be a configurable setting outside of the docker desktop.
Thanks
What Dockerfile? This topic was about running containers, not building images. When you build an image, you can copy files from the build context, not from everywhere on your system. When you run a containers, you can mount files from the server where the Docker containers are running, which is the server where the Docker daemon is running. The Docker daemon is running in the virtual machine of Docker Desktop, so the only way to share your local files with the containers in the virtual machine is sharing the files the virtual machine first.
A Docker container running on a remote server would not be able to mount files from your workstation either. It cannot be solved by a Dockerfile and not even with a compose file. Of course, Docker Dsktop can support additional features for development, so you could even enable the synchronized fileshare, but only if you have a paid subscription