docker - Docker 上的 TensorFlow : How to save the work on Jupyter notebook?

标签 docker tensorflow jupyter-notebook

Docker 和 Tensorflow 的新手并尝试它们。安装(在win10上,使用hyper-v驱动)很顺利,我可以运行了

docker run -p 8888:8888 -it gcr.io/tensorflow/tensorflow

然后得到这样的输出:

[I 23:01:01.188 NotebookApp]←(B Serving notebooks from local directory: /notebooks
[I 23:01:01.189 NotebookApp]←(B 0 active kernels
[I 23:01:01.189 NotebookApp]←(B The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/
[I 23:01:01.189 NotebookApp]←(B Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

我可以通过打开 [docker host address]:8888 从浏览器打开 Jupyter notebook。

但是,在做了一些工作(例如,创建一个新笔记本)之后,当我按 Ctrl-C 两次停止服务器时,所有新工作都丢失了。也许我错过了一些基本的东西,所以让我把我不确定的东西放在这里:

  1. 我不应该停止服务器吗?
  2. 我在重新启动时使用相同的“docker run”命令。对吗?

感谢您的帮助。

最佳答案

您可以mount当前主机文件夹以替换容器中的默认 /notebooks 文件夹。这是一个例子:

$ docker run -p 8888:8888 -v `pwd`:/notebooks -it gcr.io/tensorflow/tensorflow
[I 02:34:49.393 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
[W 02:34:49.411 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 02:34:49.420 NotebookApp] Serving notebooks from local directory: /notebooks
[I 02:34:49.421 NotebookApp] 0 active kernels 
[I 02:34:49.421 NotebookApp] The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/?token=b9da5de7f61d6a968dc07e55c6157606a4f2f378cd764a91
[I 02:34:49.421 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 02:34:49.422 NotebookApp] 

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8888/?token=b9da5de7f61d6a968dc07e55c6157606a4f2f378cd764a91

关于docker - Docker 上的 TensorFlow : How to save the work on Jupyter notebook?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36756907/

相关文章:

docker - 如何在Kubernetes中分离应用程序和数据同步实现?

node.js - docker-compose up 找不到模块,但从 bash 运行有效

tensorflow - Keras 上的 clipnorm 和 clipval 有什么区别

python - Jupyter - 在多个单元格中拆分类

jupyter-notebook - "module not found"在 jupyter 实验室中,但在 "jupyter notebook"中工作正常

docker - 无法访问 Kubernetes 集群外部的 NodePort 服务

docker - 将Ansible应用程序安装到Docker容器

python - 卷积自动编码器的 Keras valueerror

python - 在 C++ 中使用加载的 tensorflow 模型运行推理

python - 图 Pandas 各组的百分比