VirtioFS: sed -i from GNU sed 4.4 fails with "Permission denied" on bind mounts (gRPC FUSE works)

Aperta
#855 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
12/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
docker, macos

Direzione di ricerca

This is a tracker issue on docker/desktop-feedback, so no source file or test is pointed at the fix; the only reproducer is the docker run -v "$PWD":/w ubuntu:18.04 sh -c 'echo a > /w/f; sed -i s/a/b/ /w/f' command. Start by reproducing on a macOS host with VirtioFS sharing and comparing against gRPC FUSE, then narrow what sed 4.4 does beyond the C and Python mkostemp() cases that succeed. Done means that command exits 0 and f contains b under VirtioFS, which likely needs a change in Docker Desktop's file-sharing layer rather than in this repo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

kind/bug platform/macos
Bug report

On macOS with VirtioFS file sharing, in-place editing with GNU sed 4.4 (the version in Ubuntu 18.04) fails on any bind-mounted directory:

sed: couldn't open temporary file /w/sedx4aGxI: Permission denied

The same command works in the container's own filesystem, with newer sed versions on the same bind mount, and with gRPC FUSE file sharing.

This looks like the issue reported in docker/for-mac#6990 (open since Docker Desktop 4.23), which has no minimal reproducer. The one below needs only a public image.

Reproduce

Run in any directory on the Mac:

docker run --rm -v "$PWD":/w ubuntu:18.04 sh -c 'echo a > /w/f; sed -i s/a/b/ /w/f && echo ok'
  • Expected: ok, and f contains b.
  • Actual: sed: couldn't open temporary file /w/sedXXXXXX: Permission denied, exit status 4.

Results

Image sed Bind mount (VirtioFS) Container /tmp
ubuntu:18.04, linux/arm64 4.4 fails ok
ubuntu:18.04, linux/amd64 (Rosetta) 4.4 fails ok
ubuntu:22.04, linux/amd64 4.8 ok ok
Debian 12 based image, linux/amd64 4.9 ok ok

On a second Mac (macOS 26), the same failure occurs with VirtioFS, and the command works after switching file sharing to gRPC FUSE.

What we found

  • An LD_PRELOAD shim inside sed shows glibc's mkostemp() returning EACCES for the temporary file sed creates next to the edited file.
  • The same mkostemp() call (same template, umask(077), input file held open) succeeds on the same bind mount from a small C program and from Python, linked against the same glibc 2.27. We did not find what sed 4.4 does differently.
  • Ruled out: SELinux (is_selinux_enabled() returns 0), file and directory ownership, and amd64 emulation (native arm64 fails too).
  • The bind mount does not support extended attributes (listxattr returns "Operation not supported").

Impact

Any build that uses Ubuntu 18.04 images (common for embedded SDKs pinned to old toolchains) and runs sed -i on bind-mounted sources fails on macOS with the default file sharing. The only workaround we have is switching to gRPC FUSE, which is slower and applies to every project.

Environment

  • Docker Desktop 4.99.0 (245822), engine 29.9.3, kernel 7.0.14-linuxkit
  • macOS 27.2 (26B123), Apple silicon (arm64)
  • Virtualization framework: Apple Virtualization; file sharing: VirtioFS (default)
  • Also reproduced on a second Mac with macOS 26 (Docker Desktop version not recorded)
Platform

macOS

Version information
Client:
 Version:           29.9.3
 API version:       1.56
 Go version:        go1.26.10
 Git commit:        5457199
 Built:             Tue Nov  3 21:41:57 2026
 OS/Arch:           darwin/arm64
 Context:           desktop-linux

Server: Docker Desktop 4.99.0 (245822)
 Engine:
  Version:          29.9.3
  API version:      1.56 (minimum version 1.40)
  Go version:       go1.26.10
  Git commit:       70efc0e
  Built:            Tue Nov  3 21:41:25 2026
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          v2.4.2
  GitCommit:        b7a25261e029d68978bbf290df0a62fc819b3c51
 runc:
  Version:          1.5.2
  GitCommit:        v1.5.2-0-g29dd3dc2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
Client:
 Version:    29.9.3
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  agent: Docker AI Agent Runner (Docker Inc.)
    Version:  v1.153.0
    Path:     /Users/alessandro/.docker/cli-plugins/docker-agent
  ai: Docker AI Agent - Ask Gordon (Docker Inc.)
    Version:  v1.33.0
    Path:     /Users/alessandro/.docker/cli-plugins/docker-ai
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.38.1
    Path:     /Users/alessandro/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v5.7.0
    Path:     /Users/alessandro/.docker/cli-plugins/docker-compose
  debug: Get a shell into any image or container (Docker Inc.)
    Version:  0.49.0
    Path:     /Users/alessandro/.docker/cli-plugins/docker-debug
  desktop: Docker Desktop commands (Docker Inc.)
    Version:  4.99.0
    Path:     /Users/alessandro/.docker/cli-plugins/docker-desktop
  dhi: CLI for managing Docker Hardened Images (Docker Inc.)
    Version:  v0.0.10
    Path:     /Users/alessandro/.docker/cli-plugins/docker-dhi
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.32
    Path:     /Users/alessandro/.docker/cli-plugins/docker-extension
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.4.1
    Path:     /Users/alessandro/.docker/cli-plugins/docker-init
  mcp: Docker MCP Plugin (Docker Inc.)
    Version:  v0.44.3
    Path:     /Users/alessandro/.docker/cli-plugins/docker-mcp
  model: Docker Model Runner (Docker Inc.)
    Version:  v1.2.9
    Path:     /Users/alessandro/.docker/cli-plugins/docker-model
  offload: Docker Offload (Docker Inc.)
    Version:  v0.7.36
    Path:     /Users/alessandro/.docker/cli-plugins/docker-offload
  pass: Docker Pass Secrets Manager Plugin (beta) (Docker Inc.)
    Version:  v0.3.2
    Path:     /Users/alessandro/.docker/cli-plugins/docker-pass
  sandbox: "docker sandbox" is deprecated, use Docker Sandboxes instead (Docker Inc.)
    Version:  v0.13.0
    Path:     /Users/alessandro/.docker/cli-plugins/docker-sandbox
  scout: Docker Scout (Docker Inc.)
    Version:  v1.28.0
    Path:     /Users/alessandro/.docker/cli-plugins/docker-scout

Server:
 Containers: 1
  Running: 0
  Paused: 0
  Stopped: 1
 Images: 13
 Server Version: 29.9.3
 Storage Driver: overlayfs
  driver-type: io.containerd.snapshotter.v1
 Logging Driver: local
 Cgroup Driver: cgroupfs
 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
 Discovered Devices:
  cdi: docker.com/gpu=webgpu
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: b7a25261e029d68978bbf290df0a62fc819b3c51
 runc version: v1.5.2-0-g29dd3dc2
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 7.0.14-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 12
 Total Memory: 7.748GiB
 Name: docker-desktop
 ID: 110bed11-9336-422f-879a-d82a2a6ce1ab
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Labels:
  com.docker.desktop.address=unix:///Users/alessandro/Library/Containers/com.docker.docker/Data/docker-cli.sock
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
  ::1/128
 Live Restore Enabled: false
 Firewall Backend: iptables
Diagnostics ID

No response

Lingua principale
Nessun dato sulla lingua
Stelle
53
Fork
24
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di docker/desktop-feedback

Tutte le issue di docker/desktop-feedback

Issue simili

Altre issue su Desktop Dev

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.