I just got a Mac and shifted from Windows and installed Tensorflow using Docker and everything is working fine, but I want to run a python script that I have from before. Is there any way to run a python script in docker on a Mac, using the terminal?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- batch_dot with variable batch size in Keras
- How to get the background from multiple images by
- Evil ctypes hack in python
Something like the below should do...
Create a Dockerfile with the below content:
build the image:
run it:
if you want to keep the container going after the script is run don't --rm it...
More information would be very helpful, but perhaps this is useful for you.
It depends on a lot of different factors, but assuming a couple of things:
The docker containing Tensorflow has a name like 'tensorflow' already contains the python script: you can use: docker run tensorflow 'python '
If the script is not yet present, you can either use build a docker based on that image using a docker file, something along the lines of:
Or you can create/run the docker interactively by doing something along the lines of:
Docker run -ti tensorflow /bin/bash Which will start an instance of the tensorflow container and start /bin/bash on it. You now have an interactive shell so can place the python script any way you want and start it.
Lets assume you have a script
my_script.py
located at/Users/awesome_user/python_scripts/
on your macBy default the tensorFlow image bash will locate you at /notebooks.
Run this command in your terminal:
This will map your local mac folder
/Users/awesome_user/python_scripts/
to the docker's local folder/notebooks
then just run from the bash
python my_script.py
. Also runningls
should reveal your folder content