I recently upgraded my Docker Toolbox on Windows 10, and now my volume mounts no longer work. I've tried everything. Here is the current mount path:
volumes: - C:\Users\Joey\Desktop\backend:/var/www/html
I receive an invalid bind mount error.
Docker Desktop is available for Mac, Windows and Linux. Install Compose plugin: (Mac, Win, Linux) Docker Desktop: If you have Desktop installed then you already have the Compose plugin installed.
We can also create a volume with Docker compose service or also specify existing volumes. For example, the following screenshot shows a 'docker-compose' file that creates a docker-compose service with a volume. As a result of the above command, a volume with the name 'myvolume' gets created.
To run and open . yml files you have to install Docker Compose. After the installation, go to your docker-compose. yml directory and then execute docker-compose up to create and start services in your docker-compose.
This means that there is one behavior that is different between -v and --mount . If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host, -v creates the endpoint for you. It is always created as a directory.
2. execute following command
docker run --rm -v c:/Users:/data alpine ls /data
Set path in docker compose file as shown below
File copied to windows
Use:
volumes: - "C:/Users/Joey/Desktop/backend:/var/www/html"
Putting the whole thing in double quotes and using forward slashes worked for me. I was on windows 10 in windows 10 using Linux containers through WSL2
This answer was from Spenhouet given here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With