问题
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.
回答1:
I think you have to set COMPOSE_CONVERT_WINDOWS_PATHS=1
, see here.
Docker Machine should do it automatically: https://github.com/docker/machine/pull/3830
回答2:
I faced with same issue (I'm using Docker Desktop).
My steps were:
1) Place your folder under drive "C"
2) Open "Settings" in Docker Desktop -> "Shared Drives" -> "Reset Credentials" -> select drive "C" -> "Apply"
3) Open terminal and run (as proposed by Docker Desktop):docker run --rm -v c:/Users:/data alpine ls /data
4) Open your docker-compose.yml
and update path in -volumes
:
volumes:
- /data/YOUR_USERNAME/projects/my_project/jssecacerts:/usr/lib/jvm/java-1.8-openjdk/jre/lib/security/jssecacerts/
5) restart docker container
回答3:
Is this is services section? You do now need it in the volume section, so if you had it just remove it.
来源:https://stackoverflow.com/questions/41334021/volume-binding-using-docker-compose-on-windows