使用 Docker Compose 运行一个 GPU 环境

Catalogue
  1. 1. 安装 Docker
  2. 2. 安装 Docker 显卡驱动
  3. 3. Docker Compose

安装 Docker

参考 Docker 安装

安装 Docker 显卡驱动

参考 Nvidia 安装

Docker Compose

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
---
services:
code-server:
image: lscr.io/linuxserver/code-server:latest
container_name: code-server
environment:
- PUID=0
- PGID=0
- PASSWORD=<YOUR_PASSWORD>
- SUDO_PASSWORD=<YOUR_SUDO_PASSWORD>
- DEFAULT_WORKSPACE=/root/
volumes:
- /config:/config
- /root:/root
ports:
- 8443:8443
restart: unless-stopped
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]