Skip to content

Commit

Permalink
docker-compose gpu access updated, since 1.28.0 version
Browse files Browse the repository at this point in the history
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
  • Loading branch information
JaledMC authored and facebook-github-bot committed Feb 9, 2021
1 parent 8603801 commit cdeca42
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docker/README.md
Expand Up @@ -14,9 +14,9 @@ docker run --gpus all -it \
xhost +local:`docker inspect --format='{{ .Config.Hostname }}' detectron2`
```

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

Install docker-compose and nvidia-docker2, then run:
Install docker-compose and nvidia-docker-toolkit, then run:
```
cd docker && USER_ID=$UID docker-compose run detectron2
```
Expand Down
10 changes: 9 additions & 1 deletion docker/docker-compose.yml
Expand Up @@ -6,7 +6,12 @@ services:
dockerfile: Dockerfile
args:
USER_ID: ${USER_ID:-1000}
runtime: nvidia # TODO: Exchange with "gpu: all" in the future (see https://github.com/facebookresearch/detectron2/pull/197/commits/00545e1f376918db4a8ce264d427a07c1e896c5a).
deploy:
resources:
reservations:
devices:
- capabilities:
- gpu
shm_size: "8gb"
ulimits:
memlock: -1
Expand All @@ -16,3 +21,6 @@ services:
environment:
- DISPLAY=$DISPLAY
- NVIDIA_VISIBLE_DEVICES=all
# Uncomment with proper source to access webcam from docker
# devices:
# - /dev/video0:/dev/video0

0 comments on commit cdeca42

Please sign in to comment.