【发布时间】:2019-10-16 18:52:20
【问题描述】:
我正在尝试使用 docker 和 tensorflow 测试我的设置。我用的是官方的Tensorflow镜像tensorflow/tensorflow:1.15.0rc2-gpu-py3
我的项目具有最小结构:
project/
Dockerfile
docker-compose.yml
jupyter/
README.md
我有以下Dockerfile:
# from official image
FROM tensorflow/tensorflow:1.15.0rc2-gpu-py3-jupyter
# add my notebooks so they are a part of the container
ADD ./jupyter /tf/notebooks
# copy-paste from tf github dockerfile in attempt to troubleshoot
# https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/dockerfiles/dockerfiles/gpu-jupyter.Dockerfile
WORKDIR /tf
RUN which jupyter
CMD ["jupyter-notebook --notebook-dir=/tf/notebooks --ip 0.0.0.0 --no-browser --allow-root"]
还有docker-compose.yml
version: '3'
services:
tf:
image: tensorflow/tensorflow:1.15.0rc2-gpu-py3-jupyter
# mount host system volume to save updates from container
volumes:
- jupyter:/tf/notebooks
ports:
- '8888:8888'
# added as part of troubleshooting
build:
context: .
dockerfile: Dockerfile
volumes:
jupyter:
运行docker-compose build 和docker-compose up 成功(如果Dockerfile 中的CMD 被注释掉),但只是退出。在docker hub repository 中,我认为添加卷会自动启动笔记本。
尝试运行 jupyter-notebook 或 jupyter notebook 失败。
思考如何改正?
【问题讨论】:
标签: python docker tensorflow docker-compose jupyter-notebook