0

Recently I asked What is the correct way to have Tensorflow available in a docker container or docker image? and found out that I need to explicitly have the bash command when trying run Tensorflow in docker containers.

For example if one runs the image directory (with interactive move and without bash):

docker run -it --rm gcr.io/tensorflow/tensorflow

one gets a big series of confusing messages warning about encryption and ports being open:

user $ docker run -it --rm gcr.io/tensorflow/tensorflow
[I 00:39:25.658 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
[W 00:39:25.689 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 00:39:25.697 NotebookApp] Serving notebooks from local directory: /notebooks
[I 00:39:25.697 NotebookApp] 0 active kernels
[I 00:39:25.697 NotebookApp] The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/?token=54769c341c9a1e6eaa8e7a24618ba4d7e99eb16385b1ecb5
[I 00:39:25.697 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
^C[I 00:39:27.032 NotebookApp] interrupted
Serving notebooks from local directory: /notebooks
0 active kernels
The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/?token=54769c341c9a1e6eaa8e7a24618ba4d7e99eb16385b1ecb5
Shutdown this notebook server (y/[n])? ^C[C 00:39:27.895 NotebookApp] received signal 2, stopping
[I 00:39:27.897 NotebookApp] Shutting down kernels

however, when one runs:

docker run -it --rm gcr.io/tensorflow/tensorflow bash

all seems good. Does someone know why this happens?

I've noticed that sometimes when I do not specify the bash command the docker images go to bash anyway. Why is that not true for the Tensorflow image?

Also, what does that giant message with warnings about NotebookApp, etc mean?

Community
  • 1
  • 1
Charlie Parker
  • 5,884
  • 57
  • 198
  • 323

1 Answers1

1

The gcr.io/tensorflow/tensorflow image has a default command of /run_jupyter.sh which launches jupyter notebook.

When bash is specified on the command line, the default command is no longer used and the bash shell runs instead. There are no errors as the server is not running to produce them.

Look at the CMD and ENTRYPOINT docco and What is the difference between CMD and ENTRYPOINT in a Dockerfile? to see what docker runs by default on container start.

Community
  • 1
  • 1
Matt
  • 68,711
  • 7
  • 155
  • 158
  • Thanks, I do know about CMD vs ENTRYPOINT, however, how did you find out that it was using those? – Charlie Parker Dec 16 '16 at 03:15
  • I looked up the source Dockerfile on github from the images https://hub.docker.com page. Also `docker history ` will report build commands – Matt Dec 16 '16 at 04:50