{"id":8057,"date":"2021-07-06T13:06:20","date_gmt":"2021-07-06T18:06:20","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=8057"},"modified":"2021-07-06T13:06:20","modified_gmt":"2021-07-06T18:06:20","slug":"docker-and-windows-unable-to-allocate-port","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=8057","title":{"rendered":"Docker and Windows &#8212; Unable to Allocate Port"},"content":{"rendered":"<p>On the most recent iteration of Windows (20H2 build 19042.1052) and Docker Desktop (20.10.7 built Wed Jun 2 11:54:58 2021), I found myself unable to launch my Oracle container. The error indicated that the binding was forbidden.<\/p>\n<p>&nbsp;<\/p>\n<p>C:\\WINDOWS\\system32&gt;docker start oracleDB<br \/>\nError response from daemon: Ports are not available: listen tcp 0.0.0.0:1521: bind: An attempt was made to access a socket in a way forbidden by its access permissions.<br \/>\nError: failed to start containers: oracleDB<\/p>\n<p>Forbidden by whom?! Windows, it seems. Checking excluded ports using netsh:<\/p>\n<pre class=\"lang-sql s-code-block\"><code class=\"hljs language-sql\">netsh <span class=\"hljs-type\">int<\/span> ipv4 <span class=\"hljs-keyword\">show<\/span> excludedportrange protocol<span class=\"hljs-operator\">=<\/span>tcp<\/code><\/pre>\n<p>Shows that there are all sorts of ports being forbidden &#8212; Hyper-V is grabbing a lot of ports when it starts. To avoid that, you&#8217;ve got to add a manual excluded port for the one you want to use.<\/p>\n<p><a href=\"https:\/\/www.rushworth.us\/lisa\/?attachment_id=8058\" rel=\"attachment wp-att-8058\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8058\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/07\/winExcludedPortRange.png\" alt=\"\" width=\"632\" height=\"248\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/07\/winExcludedPortRange.png 632w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/07\/winExcludedPortRange-300x118.png 300w\" sizes=\"auto, (max-width: 632px) 100vw, 632px\" \/><\/a><\/p>\n<p>To reserve the port for your own use, disable Hyper-V (reboot), add a port exclusion, and enable Hyper-V (reboot)<\/p>\n<pre>REM Disable Hyper-V\r\ndism.exe \/Online \/Disable-Feature:Microsoft-Hyper-V \r\nREM REBOOT ... then add an exclusion for the Oracle DB Port\r\nnetsh int ipv4 add excludedportrange protocol=tcp startport=1521 numberofports=1 \r\ndism.exe \/Online \/Enable-Feature:Microsoft-Hyper-V \/All\r\nREM REBOOT again<\/pre>\n<p>Now 1521 is reserved for Oracle<\/p>\n<p><a href=\"https:\/\/www.rushworth.us\/lisa\/?attachment_id=8062\" rel=\"attachment wp-att-8062\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8062\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/07\/1521Excluded.png\" alt=\"\" width=\"626\" height=\"245\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/07\/1521Excluded.png 626w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/07\/1521Excluded-300x117.png 300w\" sizes=\"auto, (max-width: 626px) 100vw, 626px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>On the most recent iteration of Windows (20H2 build 19042.1052) and Docker Desktop (20.10.7 built Wed Jun 2 11:54:58 2021), I found myself unable to launch my Oracle container. The error indicated that the binding was forbidden. &nbsp; C:\\WINDOWS\\system32&gt;docker start oracleDB Error response from daemon: Ports are not available: listen tcp 0.0.0.0:1521: bind: An attempt &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[623],"tags":[231,1426,1310,136,138],"class_list":["post-8057","post","type-post","status-publish","format-standard","hentry","category-containerized-development-and-deployment","tag-docker","tag-hyper-v","tag-tcp","tag-windows","tag-windows-10"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8057","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8057"}],"version-history":[{"count":3,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8057\/revisions"}],"predecessor-version":[{"id":8063,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8057\/revisions\/8063"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8057"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8057"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8057"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}