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

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

Closed
meldafrawi opened this issue Nov 5, 2024 · 3 comments

Comments

@meldafrawi
Copy link

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

@meldafrawi meldafrawi 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 Nov 5, 2024
@ndeloof
Copy link
Contributor

ndeloof commented Nov 6, 2024

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

@ndeloof ndeloof closed this as not planned Won't fix, can't repro, duplicate, stale Nov 6, 2024
@meldafrawi
Copy link
Author

@ndeloof is a change in docs required here?

@ndeloof
Copy link
Contributor

ndeloof commented Nov 7, 2024

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
Projects
None yet
Development

No branches or pull requests

2 participants