Skip to content

Compose v2 does not respect the group_add field #8810

@JonnieCache

Description

@JonnieCache

Description

The group_add field is not respected by docker compose v2, whereas it works fine in 1.29

Steps to reproduce the issue:

  1. Create a docker-compose.yml like so:
  test:
    image: alpine
    user: "1000:1000"
    group_add:
      - 20
  1. Run it with sudo docker compose run test id

Describe the results you received:

With compose v2:
uid=1000 gid=1000

With compose v1:
uid=1000 gid=1000 groups=20(dialout)

Describe the results you expected:
Both should function the same.

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

The user field is used here purely to simplify the output, the problem occurs with and without it.

Output of docker compose version:

Docker Compose version v2.0.1

Output of docker-compose --version:

docker-compose version 1.29.2, build unknown

NOTE that while this may imply that I have both v1 and v2 installed at the same time, the issue occurs even if this is not the case.
The v1 build is installed via pip, as there is no release provided for arm64.

Output of 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.6.3-docker)
  compose: Docker Compose (Docker Inc., v2.0.1)

Server:
 Containers: 24
  Running: 1
  Paused: 0
  Stopped: 23
 Images: 22
 Server Version: 20.10.9
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  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 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 5b46e404f6b9f661a205e28d59c982d3634148f8
 runc version: v1.0.2-0-g52b36a2
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.4.0-1044-raspi
 Operating System: Ubuntu 20.04.3 LTS
 OSType: linux
 Architecture: aarch64
 CPUs: 4
 Total Memory: 3.704GiB
 Name: ha
 ID: KJZN:THA2:KZL3:ATRN:QMDS:RHEI:NH36:7D4M:TV3M:5HP2:52KT:XS36
 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 memory limit support
WARNING: No swap limit support
WARNING: No kernel memory TCP limit support
WARNING: No oom kill disable support

Additional environment details:

As you can see I happen to be running under arm64 on a raspberry pi 4; I do not believe that this is relevant, although it of course may be.

Additionally I note that the group_add option is not documented in the official composefile reference docs, but it is defined in the composefile spec repo on github

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