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

  • How to detach /dev/loop generated by docker devicemapper
  • docker-machine ssh into Vagrant VM failing
  • How to upgrade npm to npm@5 on the latest node docker image?
  • How to rename a docker image in the remote registry
  • What should WSO2 APIM <localMemberHost> parameter contain in the config and what it is used by the APIM?
  • Docker Container management in production environment
  • How to solve this?

  • Docker exec rm not working
  • Docker has two bridge networks named 'bridge'. How to remove?
  • Docker warning on cgroup swap limit, memory.use_hierarchy
  • Is there a way to prevent outside access to container memory
  • Assigning Public IP to SQL Server Docker Image
  • Network connectivity for docker containers on Ubuntu VM
  • 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.