// troubleshooting guide · jenkins

Jenkins Docker 'Permission Denied' Connecting to Docker Daemon Socket

Status
Workaround available
platforms:
Linux, Docker
updated:
November 16, 2026
reports:
4
Method
how we research
Share

RUNBOOK · jenkins/docker-permission-denied4 FIXES

// quick answer

The jenkins user can't access /var/run/docker.sock. Add it to the docker group and restart Jenkins (or the agent); avoid chmod 777 on the socket.

Most likely fix: Add jenkins to the docker group

How to fix it

// try these in order, the most common fix is first

  1. FIX 1Add jenkins to the docker group

    1. 01Run sudo usermod -aG docker jenkins
    2. 02Restart Jenkins: sudo systemctl restart jenkins (or restart the agent)
    3. 03Verify with sudo -u jenkins docker ps
    Did this fix it?
  2. FIX 2Make sure Docker is running

    1. 01Run sudo systemctl status docker
    2. 02Start it with sudo systemctl start docker if needed
    Did this fix it?
  3. FIX 3Match the group ID in containers

    1. 01Run getent group docker on the host to get the GID
    2. 02Run the Jenkins/agent container with --group-add <GID> so it can use the mounted socket
    Did this fix it?
  4. FIX 4Don't chmod 777 the socket

    1. 01chmod 777 /var/run/docker.sock is insecure and resets after a reboot
    2. 02Use the group fix instead
    Did this fix it?

SANDBOX · jenkins RUNS IN YOUR BROWSER

Try it: push, review, run CI and merge in a code host and cloud workspace

A hands-on Jenkins-style sandbox, including the spots where users get stuck. See where problems like this one start. 1-2 minutes, nothing is saved.

Symptoms

A pipeline step running docker fails with 'Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock'.

Why it happens

  • C-01The jenkins user isn't in the docker group
  • C-02Jenkins wasn't restarted after the group change, so the old groups still apply
  • C-03Inside a container, the docker group ID differs from the host's
  • C-04The Docker service isn't running

// this guide also covers

  • jenkins docker permission denied
  • permission denied while trying to connect to the docker daemon socket jenkins
  • jenkins docker.sock permission denied

Still not working?

If Jenkins keeps failing, you're not alone. See every Jenkins problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us

Watch Jenkins Get an email when its price changes, it has an outage, or we publish a new fix. No spam.

Fixed it? Share this guide

The same problem in other apps

All not loading, error messages & connection guides →

Other Jenkins errors

All 14 Jenkins errors and fixes →