Skip to content

Compose V2 tmpfs.size must be a integer #8696

@jarda-wien

Description

@jarda-wien

Description

Compose V2 complains about tmpfs size not being integer.

Steps to reproduce the issue:

  1. Start the following compose:
---
services:
  test:
    image: "busybox"
    volumes:
      - type: tmpfs
        target: /tmp/
        tmpfs:
            size: 1M
    read_only: true
    command: 'df -h /tmp/'

Describe the results you received:

docker compose up
services.test.volumes.0.tmpfs.size must be a integer

Describe the results you expected:

Old behavior, which works:

docker-compose up 
Starting compose-size_test_1 ... done
Attaching to compose-size_test_1
test_1  | Filesystem                Size      Used Available Use% Mounted on
test_1  | tmpfs                     1.0M         0      1.0M   0% /tmp
compose-size_test_1 exited with code 0

According to compose-spec, this really is just integer and a git-blame doesn't show a recent change. On the other hand, there is also shm_size,
which supports the string notation. Because of this, the parsing logic already has to be implemented.

I am not sure what to do next. The V2 implementation works according to the specification, but since the older version did support string notation, this breaks existing compose files we use. Maybe it would make sense to amend compose-spec for it to allow the same syntax as with shm_size.

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker compose version:

Docker Compose version 2.0.0
docker-compose --version
docker-compose version 1.29.2, build unknown

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Build with BuildKit (Docker Inc., v0.6.1-docker)
  compose: Docker Compose (Docker Inc., 2.0.0)

Server:
 Containers: 51
  Running: 1
  Paused: 0
  Stopped: 50
 Images: 370
 Server Version: 20.10.8
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: false
  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 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: 72cec4be58a9eb6b2910f5d10f1c01ca47d231c0.m
 runc version: v1.0.2-0-g52b36a2d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.14.8-zen1-1-zen
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 21.39GiB
 Name: T495
 ID: SKGK:YYYZ:6E4U:JUR6:MIVG:WFQD:JOPL:RKMG:SVQL:V4OY:SCPK:6AMV
 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

Additional environment details:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions