docker下安装tensorflow

一,查找镜像

root@xushi:~# docker search tensorflow
NAME                                       DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
tensorflow/tensorflow                      Official docker images for deep learning f...   809                  
jupyter/tensorflow-notebook                Jupyter Notebook Scientific Python Stack w...   49                   
xblaster/tensorflow-jupyter                Dockerized Jupyter with tensorflow              47                   [OK]
romilly/rpi-docker-tensorflow              Tensorflow and Jupyter running in docker c...   16                   
floydhub/tensorflow                        tensorflow                                      8                    [OK]
erroneousboat/tensorflow-python3-jupyter   Docker container with python 3 version of ...   8                    [OK]
bitnami/tensorflow-serving                 Bitnami Docker Image for TensorFlow Serving     5                    [OK]
tensorflow/tf_grpc_server                  Server for TensorFlow GRPC Distributed Run...   5                    
mochin/tensorflow-serving                  tensorflow-serving                              3                    [OK]
opensciencegrid/tensorflow-gpu             TensorFlow GPU set up for OSG                   3                    
tensorflow/tf_grpc_test_server             Testing server for GRPC-based distributed ...   3                    
hytssk/tensorflow                          tensorflow image with matplotlib.pyplot.im...   2                    [OK]
eboraas/tensorflow                         TensorFlow with Jupyter Notebook, includin...   2                    [OK]
bitnami/tensorflow-inception               Bitnami Docker Image for TensorFlow Inception   1                    [OK]
eywalker/tensorflow                        Docker image for TensorFlow ready environm...   1                    
eywalker/tensorflow-jupyter                TensorFlow images designed to launch Jupyt...   1                    
abhishek404/tensorflow-gpu                 Tensorflow GPU image                            1                    
mikebirdgeneau/r-tensorflow                RStudio and Tensorflow                          1                    [OK]
opensciencegrid/tensorflow                 TensorFlow image with some OSG additions        0                    
davidchiu/tensorflow09                     tensorflow09 with GPU support                   0                    
djpetti/rpinets-tensorflow                 Tensorflow container that is ready to be u...   0                    [OK]
aretelabs/tensorflow                                                                       0                    
fluxcapacitor/prediction-tensorflow                                                        0                    
mediadesignpractices/tensorflow            Tensorflow w/ CUDA (GPU) + extras               0                    [OK]
lab41/tensorflow-notebook                                                                  0                    

 二,下载tensorflow镜像

docker pull tensorflow/tensorflow使用的是默认docker.io的镜像,很慢,改成daocloud.io的镜像

root@xushi:~# docker pull daocloud.io/daocloud/tensorflow
Using default tag: latest
latest: Pulling from daocloud/tensorflow
1be7f2b886e8: Pull complete 
6fbc4a21b806: Pull complete 
c71a6f8e1378: Pull complete 
4be3072e5a37: Pull complete 
06c6d2f59700: Pull complete 
20a601a42386: Pull complete 
d8967df06d5c: Pull complete 
adbe4dda11a0: Pull complete 
eeb8b3ca49ee: Pull complete 
ab96b2cecaaa: Pull complete 
e61c2ef48dde: Pull complete 
50042b70c2f5: Pull complete 
Digest: sha256:188bcda72801c3b756d483e3110a994567f7e3d5f197860279ae68cd2a94f97c
Status: Downloaded newer image for daocloud.io/daocloud/tensorflow:latest

三,查看本地镜像

root@xushi:~# docker images
REPOSITORY                        TAG                 IMAGE ID            CREATED             SIZE
mysql                             latest              5195076672a7        11 days ago         371 MB
daocloud.io/daocloud/tensorflow   latest              414b6e39764a        3 weeks ago         1.27 GB

四,创建并启动容器

docker run -it --name tensorflow01 -v /root/docker/tensorflow/data/notebooks:/notebooks -p 6540:8888 -d 414b6e39764a

五,终端进入docker,并查看notebooks的token

root@xushi:~# docker exec -it tensorflow01 bash
root@9fd3c485a723:/notebooks# jupyter notebook list Currently running servers: http://localhost:8888/?token=e0b376d081c919423f5818695f531d4d7e7dfa5523a5049e :: /notebooks

六,在浏览器钟查看notebooks

 复制上述地址并把8888端口改成6540,然后在浏览器中打开:

http://localhost:6540/?token=e0b376d081c919423f5818695f531d4d7e7dfa5523a5049e

 

原文地址:https://www.cnblogs.com/Netsharp/p/8654683.html