Skip to content

Commit cdeca42

Browse files
JaledMCfacebook-github-bot
authored andcommitted
docker-compose gpu access updated, since 1.28.0 version
Summary: Updating gpu access from docker-compose, pointed by this comment: https://github.com/facebookresearch/detectron2/blob/45a8bfb64053d71d9d7f136fb25a6abe841dc91f/docker/docker-compose.yml#L9 The solution comes from this [pull request](docker/compose#6691), and working since 1.28.0 [release](https://github.com/docker/compose/releases). It's the [official](docker/compose#7929) replace of `runtime: nvidia` In this way, we don't need to install nvidia-docker (less prerequisites 🎉), but nvidia-container-toolkit seems to be needed yet. Pull Request resolved: #2584 Reviewed By: theschnitz Differential Revision: D26318490 Pulled By: ppwwyyxx fbshipit-source-id: f732a8d05dbd42cd72d228719507ac45caa86ea4
1 parent 8603801 commit cdeca42

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

docker/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ docker run --gpus all -it \
1414
xhost +local:`docker inspect --format='{{ .Config.Hostname }}' detectron2`
1515
```
1616

17-
## Use the container (with docker < 19.03)
17+
## Use the container (with docker-compose ≥ 1.28.0)
1818

19-
Install docker-compose and nvidia-docker2, then run:
19+
Install docker-compose and nvidia-docker-toolkit, then run:
2020
```
2121
cd docker && USER_ID=$UID docker-compose run detectron2
2222
```

docker/docker-compose.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ services:
66
dockerfile: Dockerfile
77
args:
88
USER_ID: ${USER_ID:-1000}
9-
runtime: nvidia # TODO: Exchange with "gpu: all" in the future (see https://github.com/facebookresearch/detectron2/pull/197/commits/00545e1f376918db4a8ce264d427a07c1e896c5a).
9+
deploy:
10+
resources:
11+
reservations:
12+
devices:
13+
- capabilities:
14+
- gpu
1015
shm_size: "8gb"
1116
ulimits:
1217
memlock: -1
@@ -16,3 +21,6 @@ services:
1621
environment:
1722
- DISPLAY=$DISPLAY
1823
- NVIDIA_VISIBLE_DEVICES=all
24+
# Uncomment with proper source to access webcam from docker
25+
# devices:
26+
# - /dev/video0:/dev/video0

0 commit comments

Comments
 (0)