[英]How do I use docker-compose.yml with Tensorflow + Jupyter Notebook + GPU
I've been using tensorflow docker images to run Tensorflow with GPU which works fine.我一直在使用 tensorflow docker 图像来运行带有 GPU 的 Tensorflow,效果很好。 For example, I just write this command with the --gpus all
flag.例如,我只是使用--gpus all
标志编写此命令。
docker run -it --rm --gpus all -v $PWD:/tf/notebooks -p 8888:8888 tensorflow/tensorflow:2.2.2-gpu-py3-jupyter
I would like to use docker-compose instead and was trying to follow the steps from Docker's enabling GPU access site docker website and can't get it to work with the jupyter notebook GPU Tensorflow images.我想改用 docker-compose 并试图按照 Docker 启用 GPU 访问站点docker 网站的步骤操作,但无法使其与 jupyter notebook GPU Tensorflow 图像一起使用。 Anybody know what I'm doing wrong?有谁知道我做错了什么?
Below is my docker-compose.yml code which I use to run the command docker-compose up
下面是我用来运行命令 docker docker-compose up
的 docker-compose.yml 代码
#version: "3.3"
services:
jupyter: # you can change this to whatever you want.
container_name: computer-vison
image: tensorflow/tensorflow:2.2.2-gpu-py3-jupyter
volumes:
- "./:/tf/notebooks"
ports:
- "8888:8888"
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
The error I get is我得到的错误是
ERROR: yaml.parser.ParserError: while parsing a block mapping
in "./docker-compose.yaml", line 14, column 11
expected <block end>, but found '<block mapping start>'
in "./docker-compose.yaml", line 16, column 13
It seems like an indentation error at the line with count
, try this:这似乎是count
行的缩进错误,试试这个:
#version: "3.3"
services:
jupyter: # you can change this to whatever you want.
container_name: computer-vison
image: tensorflow/tensorflow:2.2.2-gpu-py3-jupyter
volumes:
- "./:/tf/notebooks"
ports:
- "8888:8888"
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.