permission denied (volume) Docker Origin: Platform & cloud OSI layer 7 · Application Last updated 13 Oct 2026

Permission denied writing to a mounted volume inside a Docker container

The process inside the container runs as a user (UID) that doesn’t own the bind-mounted host folder, so reads/writes fail with EACCES.

Exact message you may see EACCES: permission denied, open '/apppermission denied on mounted volumechown: changing ownership of: Operation not permittedmkdir: cannot create directory: Permission denied
Seen on: Docker

Meaning

Files keep numeric UIDs across the mount. If the image runs as node (1000), www-data (33) or postgres (999) but the host folder belongs to UID 501 or root, the container user has no permission. SELinux on Fedora/RHEL adds another layer (fix with :z).

Common causes

  • Container user UID differs from the host folder owner
  • Folder created by root (Docker auto-creates missing -v paths as root)
  • SELinux labels block access
  • Read-only mount (:ro)

⚡ Quick fix

  1. Run as your UID: --user "$(id -u):$(id -g)"
  2. chown the host folder to the container UID
  3. On SELinux hosts add :z to the volume

Detailed fix by platform

Docker

  1. bash
    docker run --user "$(id -u):$(id -g)" -v "$(pwd)":/app -w /app node:20 npm ci
    sudo chown -R 999:999 ./pgdata   # postgres image UID

Docker Compose

  1. bash
    volumes:
      - ./data:/var/lib/data:z   # SELinux relabel

How to diagnose

  1. Owner — ls -ln on the host folder
  2. User — docker exec c id
  3. SELinux — getenforce

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):

0x80070005 — Windows Error 0x80070005 (E_ACCESSDENIED): Access is denied (Windows)0x80070005AADSTS65001 — AADSTS65001: The user or administrator has not consented to use the application (Azure)AADSTS65001Access to the path is denied — System.UnauthorizedAccessException: Access to the path 'x' is denied (.NET)Access to the path is…AccessDeniedException — java.nio.file.AccessDeniedException: /path (Java)AccessDeniedExceptionarchive — /etc/letsencrypt/live/<domain>/privkey.pem symlink to archive unreadable (permissions after certbot upgrade) (SSL / TLS)archiveavc: denied — SELinux is preventing ... / avc: denied { read } for pid=... (permission denied despite correct permissions) (Linux)avc: deniedbind source path does not exist — invalid mount config for type "bind": bind source path does not exist (Docker)bind source path does…clipboard write blocked — NotAllowedError: Failed to execute 'writeText' on 'Clipboard': Document is not focused. (JavaScript)clipboard write block…permissio…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.