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'”}

  • Error reading webpack-stats.json
  • Importing self-signed cert into Docker's JRE cacert is not recognized by the service
  • Use ehcache for application deployed via docker against the stateless rule
  • NGINX Reverse Proxy failing with Linked Docker Containers
  • Catching 404 and redirect to wwwroot
  • Adding CPUs accessible by docker for TensorFlow on Windows 10
  • How to solve this?

  • Postgres in Docker persistent data
  • Fixing exited docker container
  • containerized nginx log rotation with logrotate
  • How do I change the umask of a shared docker volume?
  • RUnit does not stop docker-compose's containers
  • Elastic Beanstalk Docker container running Node application exits early
  • 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.