exec permission denied 🐳 Docker

exec /entrypoint.sh: permission denied (container won't start)

The entrypoint or command isn’t marked executable inside the image, or it’s on a volume mounted noexec.

Seen on: Docker

Meaning

Files copied from Windows or from a repo without the executable bit end up mode 644 in the image. Bind-mounting the source folder over the image can also replace an executable script with a non-executable host copy.

Common causes

  • Script copied without the executable bit
  • Bind mount overrides the file with a host copy lacking +x
  • Volume/tmpfs mounted with noexec
  • Running as a non-root USER without read/execute permission

⚡ Quick fix

  1. chmod +x in the Dockerfile (or COPY --chmod=755)
  2. Commit the executable bit: git update-index --chmod=+x
  3. Run via the interpreter: ["sh", "/entrypoint.sh"]

Detailed fix by platform

Dockerfile

  1. bash
    COPY --chmod=755 entrypoint.sh /entrypoint.sh
    ENTRYPOINT ["/entrypoint.sh"]

How to diagnose

  1. Mode — docker run --rm --entrypoint ls image -l /entrypoint.sh
  2. Mounts — Is the path bind-mounted from the host?
  3. User — Which USER runs it?

🔧 Still not fixed?

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

🧠 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.