permission denied /var/run/docker.sock CI/CD Origin: Build & delivery Last updated 25 Oct 2026

Jenkins: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock

The Jenkins user is not allowed to talk to Docker — it is not in the docker group or the socket is not mounted in the container.

Exact message you may see Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sockpermission denied while trying to connect to the Docker daemon socket Jenkinsdocker.sock permission denied jenkinsdial unix /var/run/docker.sock: connect: permission denied
Seen on: Jenkins Docker Linux

Meaning

Docker's socket is root-owned with group docker. Add the jenkins user to that group and restart Jenkins, or when Jenkins runs in a container, mount the socket and match the host's docker GID. Understand that this gives the build root-equivalent power on the host.

Common causes

  • jenkins user not in the docker group
  • Jenkins not restarted after group change
  • Container without /var/run/docker.sock mounted
  • Docker GID differs between host and container
  • Rootless Docker using a different socket path

⚡ Quick fix

  1. sudo usermod -aG docker jenkins and restart Jenkins
  2. Mount -v /var/run/docker.sock:/var/run/docker.sock and add the matching --group-add
  3. Consider rootless builds (Kaniko, Buildah) for untrusted code

Detailed fix by platform

Linux

  1. id jenkins then sudo systemctl restart jenkins
  2. Check GID: stat -c '%g' /var/run/docker.sock

How to diagnose

  1. User — jenkins in docker group?
  2. Restart — Service restarted?
  3. Socket — Mounted into the container?

🔧 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: Build & delivery. Errors that are often confused with or caused by this one (click to open):

Cannot connect to the Docker daemon (GitLab) — GitLab CI: Cannot connect to the Docker daemon at tcp://docker:2375. Is the docker daemon running? (CI/CD)Cannot connect to the…Cannot perform an interactive login from a non TTY device — GitHub Actions: Error: Cannot perform an interactive login from a non TTY device (CI/CD)Cannot perform an int…Could not find credentials entry — Jenkins: ERROR: Could not find credentials entry with ID 'github-token' (CI/CD)Could not find creden…daemon — Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (Docker)daemonfailed to pull image (GitLab) — GitLab CI: ERROR: Job failed: failed to pull image "registry.example.com/app:latest" with specified policies [always]: access forbidden (CI/CD)failed to pull image …No such DSL method — Jenkins: java.lang.NoSuchMethodError: No such DSL method 'dockerBuild' found among steps (CI/CD)No such DSL methodScripts not permitted to use method — Jenkins: org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method java.lang.String toUpperCase (CI/CD)Scripts not permitted…Waiting for next available executor — Jenkins: Still waiting to schedule task — Waiting for next available executor / 'agent1' is offline (CI/CD)Waiting for next avai…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.