🔧 Fixing “Permission Denied While Trying to Connect to the Docker Daemon Socket” in Jenkins Running Jenkins builds that involve Docker can sometimes lead to frustrating errors. One such common error is: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock If you’ve stumbled upon this error during a Jenkins pipeline or freestyle job, don’t worry — you’re not alone. In this article, we’ll break down what this error means, why it happens, and how to fix it the right way. 🧠 What Does the Error Mean? When Jenkins tries to run a Docker command (like docker build , docker run , or docker rm ), it needs to communicate with the Docker daemon . On Linux systems, Docker exposes a special Unix socket file: /var/run/docker.sock This socket file controls access to Docker. Only users with permission to this file (typically, members of the docker group) can interact with Docker. So, if Jenkins shows this error: permission denied while tryi...
How to Install Jenkins on Ubuntu (Step-by-Step Guide) If you're a developer or DevOps engineer, Jenkins is one of the most powerful tools you can have in your CI/CD pipeline. In this guide, we’ll walk through how to install Jenkins on an Ubuntu system from scratch — including the setup of Java , system services , and how to access the Jenkins dashboard. 📋 Prerequisites Before diving in, make sure: You're running Ubuntu 22.04 LTS or similar You have sudo privileges Your system has access to the internet ☕ Step 1: Install Java Jenkins requires Java 17 or newer. Here’s how to install OpenJDK 17: sudo apt update sudo apt install fontconfig openjdk-21-jre You can verify the installation: java -version openjdk version "21.0.3" 2024-04-16 OpenJDK Runtime Environment ( build 21.0.3+11-Debian-2 ) OpenJDK 64-Bit Server VM ( build 21.0.3+11-Debian-2, mixed mode, sharing ) 📦 Step 2: Add Jenkins Repository Jenkins isn’t in Ubuntu’s default repos, ...