最近我问What is the correct way to have Tensorflow available in a docker container or docker image?并发现在尝试在docker容器中运行Tensorflow时我需要明确地拥有bash command
。
例如,如果运行图像目录(使用交互式移动而不使用bash):
docker run -it --rm gcr.io/tensorflow/tensorflow
一个人收到大量令人困惑的消息警告加密和端口打开:
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
然而,当一个人跑:
docker run -it --rm gcr.io/tensorflow/tensorflow bash
一切似乎都很好。有人知道为什么会这样吗?
我注意到有时候当我没有指定bash命令时,docker图像无论如何都会转向bash。为什么Tensorflow图像不正确?
此外,有关NotebookApp等警告的巨型消息是什么意思?
答案 0 :(得分:1)
gcr.io/tensorflow/tensorflow
图片的默认命令为/run_jupyter.sh
,会启动jupyter notebook
。
在命令行中指定bash
时,不再使用默认命令,而是运行bash
shell。没有错误,因为服务器没有运行来生成它们。
查看CMD和ENTRYPOINT docco以及What is the difference between CMD and ENTRYPOINT in a Dockerfile?,了解默认情况下docker在容器启动时运行的内容。