1,下载docker-compose
curl -L https://get.daocloud.io/docker/compose/releases/download/v2.4.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
2,安装;依赖
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list apt-get update apt-get install nvidia-container-toolkit
3,启动规则
#version: '' services: pytorch: image: pytorch/pytorch:1.13.0-cuda11.6-cudnn8-devel container_name: pytorch restart: always tty: true volumes: - ./work:/work deploy: resources: reservations: devices: - driver: "nvidia" count: "all" capabilities: ["gpu"] networks: - ai networks: ai: external: true
标签:compose,部署,apt,pytorch,io,nvidia,docker From: https://www.cnblogs.com/do-e/p/16884538.html