Skip to content

[BUG] Configs uid, gid and mode is will not take effect with configs of type file #12270

Closed as not planned

Description

@meldafrawi

Description

Trying to set uid, gid, and mode for a config resource of type file is not working

Steps To Reproduce

docker compose file:

name: test

configs:
  test_config:
    file: ./test.json

services:
  test:
    image: ubuntu:latest
    command: ["/bin/bash", "-c", "while true; do : ; done"]
    configs:
      - source: test_config
        target: /test.json
        uid: "33"
        gid: "33"
        mode: 0400

Check test.json file ownership & permissions:
docker compose exec -it test ls -la /test.json

Compose Version

Docker Compose version v2.29.7

Docker Environment

Client: Docker Engine - Community
Version: 27.3.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.17.1
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.29.7
Path: /usr/libexec/docker/cli-plugins/docker-compose

Server:
Containers: xxx
Running: xxx
Paused: xxx
Stopped: xxx
Images: xxx
Server Version: 27.3.1
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: 7f7fdf5fed64eb6a7caf99b3e12efcf9d60e311c
runc version: v1.1.14-0-g2c9f560
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.8.0-48-generic
Operating System: Ubuntu 22.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: xxx
Total Memory: xxx GiB
Name: nil
ID: 72f5f66c-04c5-4a36-8416-35d7066b9f0e
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

Anything else?

No response

Activity

  1. changed the title [-][BUG] Configs uid, gid and mode is will not take effect with configs with type file[/-] [+][BUG] Configs uid, gid and mode is will not take effect with configs of type file[/+] on Nov 5, 2024
  2. ndeloof commented on Nov 6, 2024

    @ndeloof
    Contributor

    This is a known limitation, as we use bind mounts to add config file inside container, and bind mount doesn't allow to override uid/gid/mode as seen by container
    See #12251 for discussion to add support for this using an alternative approach

  3. meldafrawi commented on Nov 6, 2024

    @meldafrawi
    Author

    @ndeloof is a change in docs required here?

  4. ndeloof commented on Nov 7, 2024

    @ndeloof
    Contributor

    would make sense, feel free to propose some additional notes on https://github.com/docker/docs
    But this page is a copy from github.com/compose-spec and as such not specific to Docker Compose, so hardly can have a dedicated section on limitations we have in this area. Anyway, Docker Compose will warn you about unsupported attribute when you run compose up command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions