Skip to content

Invalid error message when providing 4MB memory reservations through docker-compose #41852

@Wonskcalb

Description

@Wonskcalb

Providing 4MB memory reservations in a docker-compose yaml file shows an invalid error message stating the minimal value should be 4MB, which should be 6MB following this PR

Steps to reproduce the issue:

  1. Create the following docker-compose.yaml file
version: "3.7"

services:
  hello-world:
    image: hello-world
    deploy:
      resources:
        reservations:
          memory: 4M
  1. Run docker-compose up

Describe the results you received:
An error message stating the minimum memory reservation allowed is 4MB

ERROR: for tmp_hello-world_1  Cannot create container for service hello-world: Minimum memory reservation allowed is 4MB

Describe the results you expected:
An error message stating the minimum memory reservation allowed is 6MB

ERROR: for tmp_hello-world_1  Cannot create container for service hello-world: Minimum memory reservation allowed is 6MB

Additional information you deem important (e.g. issue happens only occasionally):
After checking around the exact line (and since docker-compose is mostly a wrapper around docker), I believe the issue is coming from this line in the daemon code.

Output of docker version:

/tmp
❯ docker --version 
Docker version 20.10.1, build 831ebeae96

/tmp
❯ docker-compose --version
docker-compose version 1.27.4, build unknown

Output of docker info:

/tmp
❯ docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-tp-docker)

Server:
 Containers: 12
  Running: 11
  Paused: 0
  Stopped: 1
 Images: 22
 Server Version: 20.10.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: 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 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b.m
 runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.10.2-2-MANJARO
 Operating System: Manjaro Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 15.12GiB
 Name: Oghma
 ID: 6O5U:ZSYA:P64B:RZEZ:JAP3:JUUP:T5PT:QIMC:Q62A:3J7A:KRUT:IU4N
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio weight support
WARNING: No blkio weight_device support

Metadata

Metadata

Assignees

No one assigned

    Labels

    exp/beginnerkind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions