gpt4 book ai didi

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

转载 作者:IT老高 更新时间:2023-10-28 21:21:48 27 4
gpt4 key购买 nike

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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com