How to run python script using Tensorflow running in Docker on Windows?

Imagine that I manage to install Tensorflow on Windows using Docker, as in these two links, for example:

TensorFlow on Windows

How to install and run TensorFlow on a Windows PC

In both links, they can use Tensorflow on the python shell (I don’t know exactly which version, I have Anaconda installed).

But what if I want to run a script that I made on my local machine with Tensorflow? How can I name a script from dockers? I mean, how can I find a script (located on my desktop, for example) from docker to run it?

+5
source share
1 answer

If you want your container (which Tensorflow has already been preinstalled since it works with the Tensorflow image) to access the script page, you need to set that script from the host to the local path in the container.

docker run -v /path/to/your/script:/path/to/script 

See " Set host file as data volume. "

The -v flag can also be used to mount a single file, and not just directories - from the host machine.

 $ docker run --rm -it -v ~/.bash_history:/.bash_history ubuntu /bin/bash 

Then from your container you will get access to the same script in /path/to/script .

Alex Pryiomka gives an example of how such a script works in tensorflow with β€ž

+4
source

Source: https://habr.com/ru/post/1237765/


All Articles