简体   繁体   English

如何在 Tensorflow + Jupyter Notebook + GPU 中使用 docker-compose.yml

[英]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.

相关问题 我如何正确地将这个 docker-compose.yml 放在一起? - How do I put together this docker-compose.yml properly? 我如何真正将 docker-compose.yml 部署到云端? - How do I really deploy docker-compose.yml to the cloud? 如何在 docker-compose.yml 中使用命令 - How to use command in docker-compose.yml 如何在docker-compose.yml的.env文件中使用环境变量? - How do I use environment variables in .env file in docker-compose.yml? 如何在Docker撰写文件(docker-compose.yml)中链接容器? - How do I link containers in a docker compose file (docker-compose.yml)? 如何从 docker-compose.yml 更改 docker-compose.yml 中已安装卷的权限? - How can I change permission of mounted volumes in docker-compose.yml from the docker-compose.yml? Docker:除了 docker-compose.yml 之外,如何使用 Dockerfile - Docker: How to use a Dockerfile in addition to docker-compose.yml 我可以将 AWS Copilot 与 docker-compose.yml 文件一起使用吗? - Can I use AWS Copilot with docker-compose.yml file? 如何在 docker-compose.yml 中模拟此“docker run”命令? - How do I emulate this "docker run" command in a docker-compose.yml? 如何在具有不同名称的同一个docker守护程序上多次运行相同的docker-compose.yml? - How do I run the same docker-compose.yml several times on same docker daemon with different names?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM