Skip to content

[BUG] Watch can't copy host file to container when user: "1000:1000" (UID:GID format) was used #12467

@baboo35

Description

@baboo35

Description

Docs says: user: Username or UID (format: <name|uid>[:<group|gid>])
But when use user: "1000:1000" (full format with GID) directive in service, for node.js for example, docker compose watch can't do a sync.

app-1  | 
app-1  | > docker compose up [email protected] start
app-1  | > node src/server.js
app-1  | 
app-1  | Server started
        ⦿ Watch enabled
        ⦿ Syncing service "app" after 1 changes were detected
WARN[0034] Error handling changed files for service app: 1 error occurred:
        * copying files to d0cd914abc7d54b63c4f131f12ff104e8b3d3ec6ec9041a44ea9bbe2cceffc7b: 
        * Error response from daemon: getent unable to find entry "1000:1000" in passwd databasetch

But when user: directive is disabled, or short format used (user: "1000"), copying works fine.

Steps To Reproduce

Use a simple repo to reproduce a bug test-docker-compose-watch-bug

Compose Version

Docker Compose version v2.30.3 (or 2.32 in 2nd case)

Docker Environment

Client:
 Version:    27.4.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.18.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.30.3
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 5
  Running: 2
  Paused: 0
  Stopped: 3
 Images: 7
 Server Version: 27.4.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: runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 88bf19b2105c8b17560993bee28a01ddc2f97182
 runc version: 
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.8.0-51-generic
 Operating System: Ubuntu Core 22
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 3.768GiB
 Name: notebook
 ID: deccbf28-7b36-44e2-8f67-5240cfa211cd
 Docker Root Dir: /var/snap/docker/common/var-lib-docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

I've tested this bug on kde neon desktop (docker compose installed through snapd edge channel) and on ubuntu server 22.04 (fresh upgraded), both tries to get the Watch to work was failed. Error message dive me onto the learn about getent from passwd. And of course getent passwd "1000:1000" has no effect, while getent passwd "1000" returns correct answer. That's why user: "1000" works fine:

docker compose exec -it app getent passwd "1000"
node:x:1000:1000:Linux User,,,:/home/node:/bin/sh

But, user: "1000:1000: is correct format by documentation. And this is good format, when we speak about copying files from container to host (correct GID on files as result).

Maybe to handle value of user before to get it to getent function? Trim it through colon, for example, if colon exists.

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