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

docker compose config outputs an invalid format for deploy.resources.limits.cpus #11903

Open
stavros-k opened this issue Jun 13, 2024 · 0 comments
Assignees
Labels

Comments

@stavros-k
Copy link

Description

docker compose config outputs an invalid format.

Input

services:
  nginx:
    image: nginx
    deploy:
      resources:
        limits:
          cpus: "2.0"
❯ docker  compose -f in.yaml config > out.yaml

❯ docker  compose -f in.yaml config > out.yaml

❯ docker compose -f out.yaml up               
1 error(s) decoding:

* error decoding 'services[nginx].deploy.resources.limits.cpus': unexpected value type int for cpus

Output

name: apps
services:
  nginx:
    deploy:
      resources:
        limits:
          cpus: 2
    image: nginx
    networks:
      default: null
networks:
  default:
    name: apps_default

Note that if you set cpus to "2.1" it works as expected.
This is probably on how yaml serializes the output.
But maybe when re-importing the outputed file, value should be converted to string first before validated/parsed.

Steps To Reproduce

See above.

Compose Version

❯ docker compose version
Docker Compose version v2.27.1

Docker Environment

❯ docker info
Client: Docker Engine - Community
 Version:    26.1.4
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.14.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.27.1
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 1
  Running: 1
  Paused: 0
  Stopped: 0
 Images: 23
 Server Version: 26.1.4
 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: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: d2d58213f83a351ca8f528a95fbd145f5654e957
 runc version: v1.1.12-0-g51d5e94
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.8.0-35-generic
 Operating System: Ubuntu 24.04 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 20
 Total Memory: 62.54GiB
 Name: my-user-tuxedo-infinity-book-pro-gen8-mk1
 ID: 94c40e6d-b572-4a2f-a475-02a342b0cf77
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants