cli icon indicating copy to clipboard operation
cli copied to clipboard

Invalid permissions for `/dev/shm`

Open zdm opened this issue 1 year ago • 6 comments

Description

I have compose file like this:

...
volumes:
      - { type: tmpfs, target: /dev/shm, tmpfs: { size: 1073741824 } }
...

Documentation says - if mode is not specified - it will create it with 1777 permissions.

And it was so until docker v28.5.2 was released.

Now it creates /dev/shm with rwxr-xr-x perms, which leads to the problems.

Reproduce

Please try to create and run docker service using compose file with the following volume:

volumes:
      - { type: tmpfs, target: /dev/shm, tmpfs: { size: 1073741824 } }

Expected behavior

No response

docker version

Client: Docker Engine - Community
 Version:           28.5.2
 API version:       1.51
 Go version:        go1.25.3
 Git commit:        ecc6942
 Built:             Wed Nov  5 14:43:10 2025
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          28.5.2
  API version:      1.51 (minimum version 1.24)
  Go version:       go1.25.3
  Git commit:       89c5e8f
  Built:            Wed Nov  5 14:43:10 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.7.28
  GitCommit:        b98a3aace656320842a23f4a392a33f46af97866
 runc:
  Version:          1.3.3
  GitCommit:        v1.3.3-0-gd842d771
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

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

Server:
 Containers: 9
  Running: 3
  Paused: 0
  Stopped: 6
 Images: 3
 Server Version: 28.5.2
 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
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: active
  NodeID: lpa0qxzmi2cfc4fyr108783xr
  Is Manager: true
  ClusterID: 3c1vpyjaysd8u1jgcfejy9g50
  Managers: 1
  Nodes: 1
  Default Address Pool: 10.0.0.0/8
  SubnetSize: 24
  Data Path Port: 4789
  Orchestration:
   Task History Retention Limit: 5
  Raft:
   Snapshot Interval: 10000
   Number of Old Snapshots to Retain: 0
   Heartbeat Tick: 1
   Election Tick: 10
  Dispatcher:
   Heartbeat Period: 5 seconds
  CA Configuration:
   Expiry Duration: 3 months
   Force Rotate: 0
  Autolock Managers: false
  Root Rotation In Progress: false
  Node Address: 192.168.175.10
  Manager Addresses:
   192.168.175.10:2377
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: b98a3aace656320842a23f4a392a33f46af97866
 runc version: v1.3.3-0-gd842d771
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.8.0-87-generic
 Operating System: Ubuntu 24.04.3 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 7.709GiB
 Name: devel
 ID: da5cc937-522d-42d6-943e-b8df463d0b25
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: zdm001
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false

Additional Info

No response

zdm avatar Nov 06 '25 08:11 zdm

+1

A downgrade of the docker packages has fixed the problem:

apt purge -y docker-ce-cli docker-ce-rootless-extras containerd.io docker-ce

apt install -y docker-ce-cli=5:28.5.1-1~debian.12~bookworm docker-ce-rootless-extras=5:28.5.1-1~debian.12~bookworm containerd.io=1.7.28-1~debian.12~bookworm docker-ce=5:28.5.1-1~debian.12~bookworm

hdr1210 avatar Nov 06 '25 14:11 hdr1210

+1

We have the same Problem after an auto update. The problem is not specific to "tmpfs" type but also occurs when using "volume" bind for the given path.

By using type "bind" we could work around it for the moment, but its not an ideal solution as the service is than bound to the current file system and needs a folder with high privileges to write in.

Karamuto avatar Nov 07 '25 05:11 Karamuto

Likely caused by runc update: https://github.com/opencontainers/runc/issues/4971

mtheiss avatar Nov 10 '25 06:11 mtheiss

Spent a lot of time searching before ending up in this thread. Got the following errors: cp: cannot create regular file ... Permission denied

Hopyfully this will help someone find this issue. Adding :mode=1777 onto our tmpfs path in docker-compose.yaml worked for us for now.

Kolbein avatar Nov 12 '25 14:11 Kolbein

Sad, but mode property is still ignored by the docker stack. Unable to imagine - why.

zdm avatar Nov 12 '25 14:11 zdm

Fixed in 29.1.1.

zdm avatar Nov 29 '25 00:11 zdm