Running a Docker image in PyCharm causes “Invalid volume specification”

I am trying to run a project based on a Docker Image (Tensorflow, following instructions from this tutorial) as described in this blog. The Docker is running fine, but I’m unable to import it in PyCharm (professional, does not work in community version). I get the following error message:

Error running main: Can’t run remote python interpreter:
{“message”:”Invalid bind mount spec
\”C:/Path-to-project/Project-name:/opt/project:rw\”:
Invalid volume specification:
‘C:/Path-to-project/Project-name:/opt/project:rw'”}

  • Docker orchestration
  • How to mount a Google cloud disk with Docker-machine / docker-compose
  • Why the docker keeps both image and image container on VM?
  • Expose container on random port on internal IP
  • Missing tag after docker stack deploy
  • Multiple static IPs for Docker containers
  • How to solve this?

  • Logging new connections in a docker container
  • .Net Core with Docker on EC2 tutorial problems
  • How to run same container on all Docker Swarm nodes
  • one docker daemon can support how many docker containers? [closed]
  • What's the difference when installing docker with 2 of these following command?
  • How to efficiently copy lots of Docker images from one private registry to another?
  • 2 Solutions collect form web for “Running a Docker image in PyCharm causes “Invalid volume specification””

    This is a Windows Linux path problem. To solve it, change project paths to the Docker file to /c/Path-to-project/Project-name (with a lower case c and forward slashes) in order to solve this problem. Inspired by this link.

    I solved this problem as follows:

    1. Go to: File -> Settings -> Project -> Project Interpreter -> Your docker interpreter -> Path mappings;
    2. Add row: {'Local path': 'C:', 'Remote path': '/c'} (replace to your drive with project; if you use this interpeter for several projects from differen drives then add them all);
    3. Go to: Run -> Edit Configurations -> Your configuration -> Docker container settings -> '...' -> Volume bindings;
    4. Select row with project’s binding (example: {'Container path': '/opt/project', 'Host path': 'C:\Users\_username_\my_python_project'}) and press ‘Edit‘.
    5. Press OK -> Apply -> OK. If first ‘OK‘ without changes did not help then replace 'Host path': 'C:\Users\_username_\my_python_project' to 'Host path': '/c/Users/_username_/my_python_project';
    6. Run your python configuration.

    About:

    • Windows 10 1607 [10.0.14393]
    • PyCharm 2016.2.3
    • Build #PY-162.1967.10, built on September 7, 2016
    • JRE: 1.8.0_102-b14 amd64
    • JVM: Java HotSpot(TM) 64-Bit Server VM by Oracle Corporation

    Why PyCharm ignore File -> Settings -> Build, Execution, Deployment -> Docker -> VirtualBox shared folders in Run -> Edit Configurations?

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.