Newbie to both Docker and Tensorflow and trying them out. Installation (on win10, using hyper-v driver) went fine and I can run
docker run -p 8888:8888 -it gcr.io/tensorflow/tensorflow
and get output like this:
[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).
and I can open Jupyter notebook from browser by opening [docker host address]:8888.
However, after doing some work (e.g., creating a new notebook), when I stop the server by Ctrl-C twice, all new work are lost. Maybe I'm missing something basic, so let me put what I'm not sure here:
Thanks for your help.
You can mount current host folder to replace the default /notebooks
folder in the container. Here is an example:
$ 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
You want run the container as a daemon. Then you can docker stop
and docker start
the container and retrieve your work.
docker run -td -p 8888:8888 gcr.io/tensorflow/
Running with -it
makes the container interactive and run in the foreground which is why the work is lost when you cancel it. Best practice and run it as a daemon so you don't have to CTRL+C to quit and can instead let docker handle the state.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With