{"id":80231,"date":"2025-05-27T12:42:00","date_gmt":"2025-05-27T07:12:00","guid":{"rendered":"https:\/\/www.guvi.in\/blog\/?p=80231"},"modified":"2025-09-09T15:17:40","modified_gmt":"2025-09-09T09:47:40","slug":"linking-jenkins-and-docker-on-windows-with-wsl","status":"publish","type":"post","link":"https:\/\/www.guvi.in\/blog\/linking-jenkins-and-docker-on-windows-with-wsl\/","title":{"rendered":"Linking Jenkins and Docker on Windows with WSL \u2013 The Simple Way"},"content":{"rendered":"\n<p>If you&#8217;re like me, running Jenkins on Windows while using Docker via WSL, you might have hit that frustrating wall where Jenkins just won\u2019t detect Docker. I ran into this exact issue, and after trying out a few setups, I found a simple and effective solution. Here&#8217;s how you can get Jenkins and Docker talking happily on a Windows machine with WSL.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>The Setup<\/strong><\/h2>\n\n\n\n<ul>\n<li><strong>Host OS:<\/strong> Windows (tested on Windows 10\/11)<br><\/li>\n\n\n\n<li><strong>WSL:<\/strong> Windows Subsystem for Linux (Ubuntu in my case)<br><\/li>\n\n\n\n<li><strong>Docker:<\/strong> Installed inside WSL<br><\/li>\n\n\n\n<li><strong>Jenkins:<\/strong> Installed natively on Windows<br><\/li>\n<\/ul>\n\n\n\n<p><strong>Also Read: <a href=\"https:\/\/www.guvi.in\/blog\/ci-cd-for-full-stack-applications\/\" target=\"_blank\" rel=\"noreferrer noopener\">Continuous Integration and Continuous Deployment (CI\/CD) for Full Stack Applications<\/a><\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>The Problem<\/strong><\/h2>\n\n\n\n<p>Jenkins couldn\u2019t recognize Docker even though Docker was working fine inside WSL. The issue? Jenkins (running on Windows) can\u2019t access Docker when it&#8217;s only running inside WSL.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"630\" src=\"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2025\/06\/2@2x-1200x630.png\" alt=\"Step-By-Step Fix\" class=\"wp-image-80829\" srcset=\"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2025\/06\/2@2x-1200x630.png 1200w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2025\/06\/2@2x-300x158.png 300w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2025\/06\/2@2x-768x403.png 768w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2025\/06\/2@2x-1536x806.png 1536w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2025\/06\/2@2x-2048x1075.png 2048w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2025\/06\/2@2x-150x79.png 150w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" title=\"\"><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The Fix (Step-by-Step)<\/strong><\/h3>\n\n\n\n<p>Here\u2019s the fix that worked for me:<\/p>\n\n\n\n<ol>\n<li><strong>Install Docker Desktop on Windows<br><br><\/strong>First, install <a href=\"https:\/\/www.docker.com\/get-started\/\" target=\"_blank\" rel=\"noreferrer noopener\">Docker Desktop<\/a> for Windows. This is key because it provides the Docker daemon that both Windows and WSL can access.<br><\/li>\n\n\n\n<li><strong>Start Docker Desktop<br><br><\/strong>After installation, launch Docker Desktop and make sure the Docker daemon is running. This bridges Docker across Windows and WSL.<br><\/li>\n<\/ol>\n\n\n\n<p><strong>Install Docker in WSL<br><br><\/strong>Open your WSL terminal and install Docker:<br><code>sudo apt update<\/code><\/p>\n\n\n\n<p><code>sudo apt install docker.io<\/code><\/p>\n\n\n\n<p>Once installed, you can test it by running:<br><br><code>docker --version<\/code><\/p>\n\n\n\n<ol start=\"3\">\n<li><strong>Open Jenkins<\/strong><strong><br><\/strong><strong><br><\/strong> Now, start Jenkins on Windows. Make sure it&#8217;s running as a service or from the .war file\u2014whatever you\u2019re using.<br><\/li>\n\n\n\n<li><strong>Install Docker Plugins in Jenkins<\/strong><strong><br><\/strong><strong><br><\/strong> Head to <strong>Manage Jenkins \u2192 Manage Plugins<\/strong> and install the following:<br>\n<ul>\n<li>Docker<br><\/li>\n\n\n\n<li>Docker Pipeline<br><\/li>\n\n\n\n<li>Docker Commons<br><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Verify the Connection<\/strong><strong><br><\/strong><strong><br><\/strong> In Jenkins, go to <strong>Manage Jenkins \u2192 Configure System<\/strong>, and add a new Docker cloud configuration using the Unix socket (if you&#8217;re bridging) or TCP (depending on how Docker Desktop is set up).<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Tip<\/strong><\/h3>\n\n\n\n<p>You might need to add your WSL user to the docker group to run Docker without sudo:<\/p>\n\n\n\n<p><code>sudo usermod -aG docker $USER<\/code><\/p>\n\n\n\n<p>Then restart your terminal or WSL session.<\/p>\n\n\n\n<p><strong>Discover: <a href=\"https:\/\/www.guvi.in\/blog\/continuous-integration-vs-continuous-deployment\/\">Continuous Integration vs Continuous Deployment in DevOps<\/a><\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Getting Started with Guvi<\/strong><\/h2>\n\n\n\n<p>Once you link Jenkins and Docker on Windows with WSL, start boosting your Jenkins knowledge to perform advanced automation tasks. Enroll in HCL Guvi\u2019s course on <a href=\"https:\/\/www.guvi.in\/courses\/software-testing-and-automation\/jenkins\/?utm_source=blog&amp;utm_medium=hyperlink&amp;utm_campaign=Linking+Jenkins+and+Docker+on+Windows+with+WSL\" target=\"_blank\" rel=\"noreferrer noopener\">Jenkins<\/a>, this provides a detailed guide towards <a href=\"https:\/\/www.guvi.in\/blog\/understanding-ci-cd\/\" target=\"_blank\" rel=\"noreferrer noopener\">CI\/CD<\/a> automation using Jenkins and <a href=\"https:\/\/www.guvi.in\/blog\/what-is-devops\/\" target=\"_blank\" rel=\"noreferrer noopener\">DevOps<\/a>. It covers concepts from beginner to advanced level along with professional certification.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>With Docker Desktop acting as the bridge, Jenkins and Docker can now play nicely\u2014even if they\u2019re 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.<\/p>\n\n\n\n<p>Got stuck somewhere? Drop your error or setup in the comments\u2014I\u2019ll try to help!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;re like me, running Jenkins on Windows while using Docker via WSL, you might have hit that frustrating wall where Jenkins just won\u2019t detect Docker. I ran into this exact issue, and after trying out a few setups, I found a simple and effective solution. Here&#8217;s how you can get Jenkins and Docker talking [&hellip;]<\/p>\n","protected":false},"author":53,"featured_media":80828,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[714],"tags":[],"views":"2325","authorinfo":{"name":"Naveen Kumar","url":"https:\/\/www.guvi.in\/blog\/author\/naveen-kumar-l\/"},"thumbnailURL":"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2025\/06\/1-2-300x116.png","jetpack_featured_media_url":"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2025\/06\/1-2.png","_links":{"self":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/80231"}],"collection":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/users\/53"}],"replies":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/comments?post=80231"}],"version-history":[{"count":7,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/80231\/revisions"}],"predecessor-version":[{"id":86727,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/80231\/revisions\/86727"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/media\/80828"}],"wp:attachment":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/media?parent=80231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/categories?post=80231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/tags?post=80231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}