Why won't my Python script run using Docker?
<p>I need to use Tensorflow on my Windows machine. I have installed Docker, and following these two tutorials (<a href="https://runnable.com/docker/python/dockerize-your-python-application" rel="nofollow">https://runnable.com/docker/python/dockerize-your-python-application</a> and <a href="https://civisanalytics.com/blog/engineering/2014/08/14/Using-Docker-to-Run-Python/" rel="nofollow">https://civisanalytics.com/blog/engineering/2014/08/14/Using-Docker-to-Run-Python/</a>), I am trying to run my Python script. My Dockerfile is nearly identical to the one in the first tutorial, except that instead of installing pystrich, I'm installing Tensorflow. I've successfully made a Docker image called python-stuff, and I've made a script called my_script.py which just imports Tensorflow and then prints Hello world.</p>

<p>When I run the command <code>docker run python-stuff python my_script.py</code>, I don't get any errrors, but the script does not produce any output. Any ideas?</p>

<p>EDIT: My Dockerfile:</p>

<pre><code>FROM python:3
ADD my_script.py /
RUN pip3 install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.9.0-cp35-cp35m-linux_x86_64.whl
CMD ["python", "./my_script.py"]
</code></pre>

<p>Running <code>docker logs python-stuff</code> gives <code>Error: No such container: python-stuff</code></p>

<p>If you want to see inline output, try adding the <code>--tty</code> and <code>--interactive</code> (or <code>-ti</code> for short) options.  This will give you the stdout from your container on the console, as well as interact via stdin with your script.</p>

<p>The other way to run is with <code>--detach</code>, which will run in the background.  If you do this, you Docker will print the container ID to the console, and you can then run <code>docker logs ${ID}</code> (replacing <code>${ID}</code> with the ID that was printed, to see the current output your script has written to stdout.  If you want to avoid using the long, generated ID, you can add the <code>--name foo</code> option to your container, to add a name which can be used in commands like <code>docker logs foo</code>.</p>

python windows docker tensorflow