1>下载
docker pull tensorflow/tensorflow
注:对应的为docker.io/tensorflow/tensorflow
2>运行jupyter
2.1运行
docker run -p 8888:8888 -p 6006:6006 tensorflow/tensorflow
启动后显示信息:
[I 06:36:59.777 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
[W 06:36:59.816 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 06:36:59.827 NotebookApp] Serving notebooks from local directory: /notebooks
[I 06:36:59.827 NotebookApp] 0 active kernels
[I 06:36:59.827 NotebookApp] The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/?token=12d770087a7668b5b0a4aecf12c437069a617bcde42de9b9
[I 06:36:59.827 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 06:36:59.827 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=12d770087a7668b5b0a4aecf12c437069a617bcde42de9b9
说明:
1、使用http://localhost:8888/?token=12d770087a7668b5b0a4aecf12c437069a617bcde42de9b9可以进行访问,因为宿主主机进行了映射端口,可以直接在8888上进行操作。
2、启动以后已经是后台服务,关闭终端后,仍然可以进行操作
交互启动
docker run -it -p 8888:8888 -p 6006:6006 tensorflow/tensorflow
后台启动
docker run –d -p 8888:8888 -p 6006:6006 tensorflow/tensorflow
注:启动后在8888端口上监听
2.2通过宿主主机或者本地的浏览器访问tensorflow并测试
版本说明:
见:http://stackoverflow.com/questions/34694701/tensorflow-which-docker-image-to-use
There are four images:
- b.gcr.io/tensorflow/tensorflow: TensorFlow CPU binary image.
- b.gcr.io/tensorflow/tensorflow:latest-devel: CPU Binary image plus source code.
- b.gcr.io/tensorflow/tensorflow:latest-gpu: TensorFlow GPU binary image.
- gcr.io/tensorflow/tensorflow:latest-devel-gpu: GPU Binary image plus source code.
查看容器ip:
[root@bogon ~]# docker inspect 5eb16eb805c3 | grep IPAddress
"SecondaryIPAddresses": null,
"IPAddress": "172.17.0.2",
"IPAddress": "172.17.0.2",
查看容器端口:
[root@bogon ~]# docker port 5eb16eb805c3
6006/tcp -> 0.0.0.0:6006
8888/tcp -> 0.0.0.0:8888
2.3查看相关日志
[root@bogon ~]# docker logs --help
Usage: docker logs [OPTIONS] CONTAINER
Fetch the logs of a container
-f, --follow Follow log output
--help Print usage
--since Show logs since timestamp
-t, --timestamps Show timestamps
--tail=all Number of lines to show from the end of the logs
docker logs -f f2b4c9bb53dd
同tail -f的用途
docker logs – t 2b4c9bb53dd
显示日志包括所有的时间戳
3>运行TensorBoard
3.1运行
docker run -p 6006:6006 tensorflow/tensorflow tensorboard --logdir=/opt/tensor
3.2浏览器访问:
3.3进入tensorboard容器中运行相关代码
说明:docker中运行外部数据需要挂载外部卷来操作
4>启动脚本
#!/bin/bash setenforce 0 ifconfig | grep -w inet docker ps -l echo 按任意键继续 read -n 1 docker run -it -p 8888:8888 -p 6006:6006 -v /data/article:/article docker.io/tensorflow/tensorflow
绑定一个文件夹启动
5>参考文档
scikit.官方例子: http://scikit-learn.org/stable/auto_examples/index.html
TensorBoard简介(docker可以启动可视化界面) http://www.cnblogs.com/lienhua34/p/5998885.html
tensorflow例子教程 http://wiki.jikexueyuan.com/project/tensorflow-zh/
github上tensorflow例子 https://github.com/aymericdamien/TensorFlow-Examples
使用GBDT选取特征 http://www.letiantian.me/2015-03-31-use-gbdt-to-select-features/
scikit官方api http://scikit-learn.org/stable/
机器学习之用Python从零实现贝叶斯分类器 http://python.jobbole.com/81019/
机器学习算法一般步骤 http://www.cnblogs.com/chaoren399/p/4851658.html
基于机器学习方法的POI品类推荐算法 http://tech.meituan.com/category-recommend-base-ml.html
Tensorflow学习笔记3:TensorBoard可视化学习 http://www.cnblogs.com/lienhua34/p/5998885.html