简体   繁体   English

如何使用官方Tensorflow docker容器在主机目录中保存和编辑Jupyter笔记本?

[英]How to save and edit a Jupyter notebook in a host directory using official Tensorflow docker container?

I want to use the official Tensorflow docker images to create and edit a Jupyter notebook stored on the host. 我想使用官方的Tensorflow docker镜像来创建和编辑存储在主机上的Jupyter笔记本。

I'm a little confused with what switches I need to provide. 我对我需要提供的开关感到困惑。 To run a Tensorflow script on the host the docs suggest: 要在主机上运行Tensorflow脚本,文档建议:

docker run -it --rm -v $PWD:/tmp -w /tmp tensorflow/tensorflow python ./script.py

..and to run the Jupyter service: ..并运行Jupyter服务:

docker run -it -p 8888:8888 tensorflow/tensorflow:nightly-py3-jupyter

When I try merging the switches to run Jupyter + mount the host volume: 当我尝试合并交换机以运行Jupyter + mount主机卷时:

docker run -it --rm -v $PWD:/tmp -w /tmp -p 8888:8888 tensorflow/tensorflow:nightly-py3-jupyter

...its still accessing notebooks stored in the container, not the host. ...它仍在访问存储在容器中的笔记本,而不是主机。

Notebooks are stored inside the container /tf folder, so copying your files there will do the trick: 笔记本存储在container / tf文件夹中,因此将文件复制到那里就可以了:

docker run -it --rm -v $PWD:/tf  -p 8888:8888 tensorflow/tensorflow:nightly-py3-jupyter

The first command you mentioned is used to run a TensorFlow program developed on the host machine, not a notebook. 您提到的第一个命令用于运行在主机上开发的TensorFlow程序 ,而不是笔记本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Docker上的Tensorflow:如何在Jupyter笔记本上保存工作? - Tensorflow on Docker: How to save the work on Jupyter notebook? 无法更改在 tensorflow docker 容器上运行的 jupyter 笔记本的工作目录 - Unable to change working directory for a jupyter notebook running on a tensorflow docker container 如何从Docker容器正确编辑主机目录 - How to properly edit host directory from a docker container 如何使用在主机机器中运行的 Jupyter Notebook 中运行在 docker 容器中的 ipython 内核? - How to use ipython kernel running in docker container from Jupyter Notebook running in host machne? Docker 容器将日志保存在主机目录 - Docker container save logs on the host directory 如何使用 docker 组合将主机目录作为卷安装在 docker 容器中 - How to mount a host directory as volume in docker container using docker compose 保存/保留在 Windows 10 主机上的 docker 容器中创建的 jupyter 笔记本 - Save/persist jupyter notebooks created in docker container on Windows 10 host 如何使用远程API在Docker容器中挂载主机目录 - How to mount host directory in docker container using remote api 如何使用 Dockerfile 将目录从 docker 容器复制到主机? - How to copy a directory from docker container to host using Dockerfile? 如何从主机编辑 Docker 容器文件? - How to edit Docker container files from the host?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM