header_logo
Post thumbnail
ACADEMICS

Linking Jenkins and Docker on Windows with WSL – The Simple Way

By Naveen Kumar

If you’re like me, running Jenkins on Windows while using Docker via WSL, you might have hit that frustrating wall where Jenkins just won’t detect Docker. I ran into this exact issue, and after trying out a few setups, I found a simple and effective solution. Here’s how you can get Jenkins and Docker talking happily on a Windows machine with WSL.

Table of contents


  1. The Setup
  2. The Problem
    • The Fix (Step-by-Step)
    • Tip
  3. Getting Started with Guvi
  4. Conclusion

The Setup

  • Host OS: Windows (tested on Windows 10/11)
  • WSL: Windows Subsystem for Linux (Ubuntu in my case)
  • Docker: Installed inside WSL
  • Jenkins: Installed natively on Windows

The Problem

Jenkins couldn’t recognize Docker even though Docker was working fine inside WSL. The issue? Jenkins (running on Windows) can’t access Docker when it’s only running inside WSL.

Step-By-Step Fix

The Fix (Step-by-Step)

Here’s the fix that worked for me:

  1. Install Docker Desktop on Windows

    First, install Docker Desktop for Windows. This is key because it provides the Docker daemon that both Windows and WSL can access.
  2. Start Docker Desktop

    After installation, launch Docker Desktop and make sure the Docker daemon is running. This bridges Docker across Windows and WSL.

Install Docker in WSL

Open your WSL terminal and install Docker:
sudo apt update

sudo apt install docker.io

Once installed, you can test it by running:

docker --version

  1. Open Jenkins

    Now, start Jenkins on Windows. Make sure it’s running as a service or from the .war file—whatever you’re using.
  2. Install Docker Plugins in Jenkins

    Head to Manage Jenkins → Manage Plugins and install the following:
    • Docker
    • Docker Pipeline
    • Docker Commons
  3. Verify the Connection

    In Jenkins, go to Manage Jenkins → Configure System, and add a new Docker cloud configuration using the Unix socket (if you’re bridging) or TCP (depending on how Docker Desktop is set up).

Tip

You might need to add your WSL user to the docker group to run Docker without sudo:

sudo usermod -aG docker $USER

Then restart your terminal or WSL session.

Getting Started with Guvi

Once you link Jenkins and Docker on Windows with WSL, start boosting your Jenkins knowledge to perform advanced automation tasks. Enroll in Guvi’s course on Jenkins, this provides a detailed guide towards CI/CD automation using Jenkins and DevOps. It covers concepts from beginner to advanced level along with professional certification.

Conclusion

With Docker Desktop acting as the bridge, Jenkins and Docker can now play nicely—even if they’re on different parts of your system. This setup gives you the best of both worlds: a native Windows Jenkins setup and the flexibility of Docker in WSL.

Got stuck somewhere? Drop your error or setup in the comments—I’ll try to help!

Success Stories

Did you enjoy this article?

Schedule 1:1 free counselling

Similar Articles

Loading...
Share logo Copy link
Power Packed Webinars
Free Webinar Icon
Power Packed Webinars
Subscribe now for FREE! 🔔
close
Webinar ad
Table of contents Table of contents
Table of contents Articles
Close button