 {"id":519567,"date":"2025-11-08T10:28:05","date_gmt":"2025-11-08T17:28:05","guid":{"rendered":"https:\/\/jorgep.com\/blog\/?p=519567"},"modified":"2025-12-04T12:24:12","modified_gmt":"2025-12-04T19:24:12","slug":"portainer-agent-on-windows-fixing-lan-access","status":"publish","type":"post","link":"https:\/\/jorgep.com\/blog\/portainer-agent-on-windows-fixing-lan-access\/","title":{"rendered":"Portainer Agent on Windows: Fixing LAN Access"},"content":{"rendered":"\n<div style=\"font-family: Verdana, Geneva, sans-serif; font-size: 11px;\"><b>Disclaimer<\/b>: \u00a0I work for <a href=\"https:\/\/www.dell.com\/en-us\/work\/learn\/by-service-type-deployment\">Dell Technology Services<\/a> as a Workforce Transformation Solutions Principal.\u00a0 \u00a0 It is my passion to help guide organizations\u00a0through the current technology transition specifically as it relates to <a href=\"https:\/\/www.delltechnologies.com\/en-us\/what-we-do\/workforce-transformation.htm\">Workforce Transformation<\/a>.\u00a0 Visit <a href=\"https:\/\/www.delltechnologies.com\/en-us\/index.htm\">Dell Technologies<\/a>\u00a0site for more information.\u00a0 Opinions are my own and not the views of my employer.<\/div>\n<div><\/div><br>\n\n\n\n<p><a href=\"https:\/\/www.portainer.io\/\" data-type=\"link\" data-id=\"https:\/\/www.portainer.io\/\">Portainer<\/a> makes managing Docker containers simple, and the Portainer Agent allows you to manage multiple Docker hosts from a central Portainer instance. But if you\u2019re running Docker Desktop on Windows, making the agent accessible from other computers on your local network can be tricky. <br>In this post, I show how to solve this common LAN connectivity issue.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>The goal is to access the agent from another computer on the LAN<\/p>\n\n\n\n<p>Note:  Please see my other post about <a href=\"https:\/\/jorgep.com\/blog\/updating-docker-containers\/\">Updating Docker Containers<\/a> <\/p>\n\n\n<style>.wp-block-kadence-advancedheading.kt-adv-heading519190_4a1b6f-84, .wp-block-kadence-advancedheading.kt-adv-heading519190_4a1b6f-84[data-kb-block=\"kb-adv-heading519190_4a1b6f-84\"]{font-size:var(--global-kb-font-size-sm, 0.9rem);font-style:normal;}.wp-block-kadence-advancedheading.kt-adv-heading519190_4a1b6f-84 mark.kt-highlight, .wp-block-kadence-advancedheading.kt-adv-heading519190_4a1b6f-84[data-kb-block=\"kb-adv-heading519190_4a1b6f-84\"] mark.kt-highlight{font-style:normal;color:#f76a0c;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;}.wp-block-kadence-advancedheading.kt-adv-heading519190_4a1b6f-84 img.kb-inline-image, .wp-block-kadence-advancedheading.kt-adv-heading519190_4a1b6f-84[data-kb-block=\"kb-adv-heading519190_4a1b6f-84\"] img.kb-inline-image{width:150px;vertical-align:baseline;}<\/style>\n<p class=\"kt-adv-heading519190_4a1b6f-84 wp-block-kadence-advancedheading\" data-kb-block=\"kb-adv-heading519190_4a1b6f-84\">AI Disclaimer I love exploring new technology, and that includes using AI to help with research and editing! My digital &#8220;team&#8221; includes tools like Google Gemini, Notebook LM, Microsoft Copilot, Perplexity.ai, Claude.ai, and others as needed. They help me gather insights and polish content\u2014so you get the best, most up-to-date information possible.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">My <strong>Setup<\/strong><\/h3>\n\n\n\n<p>We were running:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Windows 11 with <strong>Docker Desktop (WSL2 backend)<\/strong><\/li>\n\n\n\n<li>Portainer Agent in a Docker container<\/li>\n\n\n\n<li>Full Portainer running on a different Windows 11 computer on my LAN.<\/li>\n\n\n\n<li><\/li>\n<\/ul>\n\n\n\n<p>The agent was started with the typical command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -d -p 9100:9001 --name portainer_agent --restart=always `\n  -v \/var\/run\/docker.sock:\/var\/run\/docker.sock `\n  -v \/var\/lib\/docker\/volumes:\/var\/lib\/docker\/volumes `\n  -v \/:\/host `\n  portainer\/agent:2.33.5\n<\/code><\/pre>\n\n\n\n<p>Locally, everything worked:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl http:\/\/localhost:9100\/ping\n# Output: Agent successful\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The Problem<\/strong><\/h3>\n\n\n\n<p>When trying to access the agent from any other PC on my LAN:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl http:\/\/192.168.4.39:9100\/ping\n<\/code><\/pre>\n\n\n\n<p>We got errors like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Client sent an HTTP request to an HTTPS server\n<\/code><\/pre>\n\n\n\n<p>or<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>context deadline exceeded\n<\/code><\/pre>\n\n\n\n<p><strong>Cause:<\/strong> On Windows with Docker Desktop + WSL2, published ports bind only to <code>localhost<\/code> by default. Also, <code>wslrelay.exe<\/code> can intercept ports, preventing LAN access.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The Solution<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>1. Pick a free port<\/strong><\/h4>\n\n\n\n<p>We ran the agent on <strong>9100<\/strong> instead of 9001 to avoid conflicts.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>2. Set up a persistent port proxy<\/strong><\/h4>\n\n\n\n<p>This forwards LAN traffic to the agent inside Docker Desktop:<\/p>\n\n\n\n<p>Open PowerShell <strong>as Administrator<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=9100 connectaddress=127.0.0.1 connectport=9100\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>0.0.0.0<\/code> \u2192 listens on all network interfaces<\/li>\n\n\n\n<li><code>127.0.0.1:9100<\/code> \u2192 where the agent is running inside Docker<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>3. Allow the port through Windows Firewall<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>netsh advfirewall firewall add rule name=\"PortainerAgent\" dir=in action=allow protocol=TCP localport=9100\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>4. Test from another computer<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>curl http:\/\/192.168.4.39:9100\/ping\n# Output: Agent successful\n<\/code><\/pre>\n\n\n\n<p>Now the Portainer Agent is reachable from any computer on the local network.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Tips &amp; Notes<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The <code>portproxy<\/code> and firewall rules are <strong>persistent<\/strong> across reboots.<\/li>\n\n\n\n<li>If your Windows PC uses DHCP, consider a <strong>static LAN IP<\/strong> or keep <code>listenaddress=0.0.0.0<\/code>.<\/li>\n\n\n\n<li>The agent should <strong>never be exposed directly to the internet<\/strong> without proper TLS.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h3>\n\n\n\n<p>Running the Portainer Agent on Windows with Docker Desktop is straightforward \u2014 once you know how to make it accessible on your LAN. Using a different port and a persistent port proxy solves the common issue where the agent works locally but cannot be reached from other devices.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Portainer makes managing Docker containers simple, and the Portainer Agent allows you to manage multiple Docker hosts from a central Portainer instance. But if you\u2019re running Docker Desktop on Windows, making the agent accessible from other computers on your local network can be tricky. In this post, I show how to solve this common LAN&#8230;<\/p>\n","protected":false},"author":2,"featured_media":519237,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","ngg_post_thumbnail":0,"episode_type":"","audio_file":"","podmotor_file_id":"","podmotor_episode_id":"","cover_image":"","cover_image_id":"","duration":"","filesize":"","filesize_raw":"","date_recorded":"","explicit":"","block":"","itunes_episode_number":"","itunes_title":"","itunes_season_number":"","itunes_episode_type":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[441],"tags":[917,919,742,1011],"class_list":["post-519567","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech-talk","tag-containers","tag-docker","tag-moderneuc1","tag-portainer"],"taxonomy_info":{"category":[{"value":441,"label":"Tech Talk"}],"post_tag":[{"value":917,"label":"Containers"},{"value":919,"label":"Docker"},{"value":742,"label":"ModernEUC"},{"value":1011,"label":"Portainer"}]},"featured_image_src_large":["https:\/\/jorgep.com\/blog\/wp-content\/uploads\/Featured-Helpful-Hints-Series.png",930,330,false],"author_info":{"display_name":"Jorge Pereira","author_link":"https:\/\/jorgep.com\/blog\/author\/jorge\/"},"comment_info":0,"category_info":[{"term_id":441,"name":"Tech Talk","slug":"tech-talk","term_group":0,"term_taxonomy_id":451,"taxonomy":"category","description":"","parent":0,"count":670,"filter":"raw","cat_ID":441,"category_count":670,"category_description":"","cat_name":"Tech Talk","category_nicename":"tech-talk","category_parent":0}],"tag_info":[{"term_id":917,"name":"Containers","slug":"containers","term_group":0,"term_taxonomy_id":927,"taxonomy":"post_tag","description":"","parent":0,"count":6,"filter":"raw"},{"term_id":919,"name":"Docker","slug":"docker","term_group":0,"term_taxonomy_id":929,"taxonomy":"post_tag","description":"","parent":0,"count":9,"filter":"raw"},{"term_id":742,"name":"ModernEUC","slug":"moderneuc1","term_group":0,"term_taxonomy_id":752,"taxonomy":"post_tag","description":"","parent":0,"count":284,"filter":"raw"},{"term_id":1011,"name":"Portainer","slug":"portainer","term_group":0,"term_taxonomy_id":1021,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"}],"_links":{"self":[{"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/posts\/519567","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/comments?post=519567"}],"version-history":[{"count":2,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/posts\/519567\/revisions"}],"predecessor-version":[{"id":519582,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/posts\/519567\/revisions\/519582"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/media\/519237"}],"wp:attachment":[{"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/media?parent=519567"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/categories?post=519567"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/tags?post=519567"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}