Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Impossible to set deploy section GPU count via environment interpolation #11097

Closed
zacps opened this issue Oct 15, 2023 · 4 comments
Closed

Comments

@zacps
Copy link

zacps commented Oct 15, 2023

Description

GPU selection is often machine dependent, however it is currently impossible to set the count of GPUs requested via environment interpolation, for example:

services:
  my-service:
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: ${GPUS:-all}
              capabilities: [gpu]

With GPUS=1 in .env, gives:

error decoding 'Deploy.Resources.Reservations.devices[0]': invalid string value for 'count' (the only value allowed is 'all')

Compose Version

Docker Compose version v2.12.2

Docker Environment

Client:
 Version:    24.0.5
 Context:    default
 Debug Mode: false

Server:
 Containers: 12
  Running: 2
  Paused: 0
  Stopped: 10
 Images: 38
 Server Version: 24.0.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version:
 runc version:
 init version:
 Security Options:
  apparmor
  seccomp
   Profile: builtin
 Kernel Version: 5.4.0-162-generic
 Operating System: Ubuntu 20.04.6 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 32
 Total Memory: 93.84GiB
 Name: bubbles02
 ID: d3406107-556b-4d7c-b46b-d7bcbca7b616
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No swap limit support
@ndeloof
Copy link
Contributor

ndeloof commented Oct 16, 2023

Tried to reproduce, got the expected variable being interpolated:

$ docker compose config
services:
  my-service:
    deploy:
      resources:
        reservations:
          devices:
            - capabilities:
                - gpu
              driver: nvidia
              count: 1

@zacps
Copy link
Author

zacps commented Oct 16, 2023

On what docker/compose version?

@ndeloof
Copy link
Contributor

ndeloof commented Oct 17, 2023

I'm running latest (v1.22.0)
v2.12.2 you're using is obsolete, please upgrade

@zacps
Copy link
Author

zacps commented Oct 17, 2023

Confirmed this works on Compose version v2.21.0, my bad!

@zacps zacps closed this as completed Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants