James Dean
James Dean

Reputation: 205

docker-compose error: "no such file or directory" on Windows

I am following along with this tutorial for running a Flask server using Docker. I am working on a Windows machine so I am using Docker Toolbox.

Once I enter the command to create the database table:

docker-compose run web /usr/local/bin/python create_db.py 

I get the following error:

Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "exec: \"C:/Program Files/Git/usr/local/bin/python\": stat C:/Program Files/Git/usr/local/bin/python: no such file or directory": unknown

I am not sure why I am getting this error, any suggestions on how to fix this error would be greatly appreciated. Thank you.

Upvotes: 2

Views: 3989

Answers (2)

pushStack
pushStack

Reputation: 4313

I had to change the current directory, and then to execute the script :

docker-compose run web bash -c "cd /usr/local/bin/; python create_db.py"

Upvotes: 0

MaartenDev
MaartenDev

Reputation: 5802

The command fails because windows tries to parse the path, this can be circumvented by quoting the path:

docker-compose run web python create_db.py

If the above fails a double dash can be used:

docker-compose run web -- "/usr/local/bin/python create_db.py"

Upvotes: 1

Related Questions