Trying to run test Python script from Docker using Bash. Win10 OS.
I have a file print.py
in the directory C:/Py/test
- run this
$ cd C:/Py/test
- run this
$ docker run --volume $(pwd):/home/${USER} python:3.7 python /home/${USER}/print.py
Got this error: python: can't open file 'C:/Program Files/Git/home/print.py': [Errno 2] No such file or directory
Why is this file trying to be found in the C:/Program Files/Git/home/
directory instead of C:\Py\test
?
$ python 'print.py'
is working
CodePudding user response:
Git bash prepended its installation path, try these two methods :
Use: //home/${USER}/print.py
Run with: MSYS_NO_PATHCONV=1 docker run ...