{"id":10005,"date":"2023-12-08T22:12:00","date_gmt":"2023-12-08T22:12:00","guid":{"rendered":"https:\/\/putridparrot.com\/blog\/?p=10005"},"modified":"2023-12-08T23:25:28","modified_gmt":"2023-12-08T23:25:28","slug":"docker-on-windows","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/docker-on-windows\/","title":{"rendered":"Docker on Windows"},"content":{"rendered":"<p><em>Note: I\u2019m going through draft posts that go back to 2014 and publishing where they still may have value. They may not be 100% upto date but better published late than never.<\/em><\/p>\n<p>Up until recently I&#8217;ve been solely using Docker on Linux, but I&#8217;ve a need to use it with Windows now. I&#8217;ve installed Docker Desktop and set to <em>Switch to Windows containers<\/em>.<\/p>\n<p>So first off we&#8217;re going to download a Windows image, whilst there are several variants, for server, nano windows, we&#8217;re going to go pretty much full blown using<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ndocker pull mcr.microsoft.com\/windows:2004\r\n<\/pre>\n<p><em>Note: It may take some time to download, it&#8217;s > 3GB<\/em><\/p>\n<p>Now just to prove it worked let&#8217;s run it in interactive mode and starting the cmd prompt using<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ndocker run -it mcr.microsoft.com\/windows:2004 cmd.exe\r\n<\/pre>\n<p>Exit your image by typing <em>exit<\/em> followed by return.<\/p>\n<p>I&#8217;m going to want to create a volume to save\/share files with the Windows machine running the container, so let&#8217;s create a folder c:\\shared and then copy or create a file in here, just to allow us to prove we can connect to it through the container, so mine&#8217;s predictably HelloWorld.txt, now run<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ndocker run -it -v c:\\shared:c:\\shared mcr.microsoft.com\/windows:2004 cmd.exe\r\n<\/pre>\n<p><em>Note: Change cmd.exe to powershell.exe if you prefer<\/em><\/p>\n<p>I&#8217;m naming the folder in the image the same as the real machine&#8217;s folder, but you can change it to suit, just change the second path like this<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ndocker run -it -v c:\\shared:c:\\shared2 mcr.microsoft.com\/windows:2004 cmd.exe\r\n<\/pre>\n<p>and if you created a simple text file with a message in it, once we&#8217;re inside the container we can type<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ntype HelloWorld.txt\r\n<\/pre>\n<p>from the c:\\shared folder to see it it&#8217;s as expected.<\/p>\n<p>Now I&#8217;m wanting to start to install applications into the container, but with no GUI we need &#8220;silent installs&#8221;<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nmsiexec \/i .\\myapp.msi \/QN \/L*V install.log\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Note: I\u2019m going through draft posts that go back to 2014 and publishing where they still may have value. They may not be 100% upto date but better published late than never. Up until recently I&#8217;ve been solely using Docker on Linux, but I&#8217;ve a need to use it with Windows now. I&#8217;ve installed Docker [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[102,710],"tags":[],"class_list":["post-10005","post","type-post","status-publish","format-standard","hentry","category-docker","category-windows-container"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/10005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=10005"}],"version-history":[{"count":5,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/10005\/revisions"}],"predecessor-version":[{"id":10330,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/10005\/revisions\/10330"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=10005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=10005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=10005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}