{"id":844,"date":"2019-07-03T07:37:46","date_gmt":"2019-07-03T07:37:46","guid":{"rendered":"http:\/\/shijuvarghese.com\/?p=844"},"modified":"2019-07-03T07:37:46","modified_gmt":"2019-07-03T07:37:46","slug":"docker-mounting-a-windows-file-share-to-a-container","status":"publish","type":"post","link":"http:\/\/shijuvarghese.com\/?p=844","title":{"rendered":"Docker: Mounting a Windows File share to a Container"},"content":{"rendered":"<p>This document helps to mount a folder shared by a Windows server, to a folder in a CentOS container.<\/p>\n<ul>\n<li>Share a folder from the Windows server, so that it can be accessed from any other Windows laptop using the following URL: \\\\192.168.0.150\\myshare<\/li>\n<li>The username to access the share is &#8220;user1&#8221; and the password &#8220;mypass&#8221;<\/li>\n<\/ul>\n<p>Procedure to mount the share to a server where Docker is running.<\/p>\n<ul>\n<li>Create a new user in the server.<\/li>\n<li>Let us assume the UIG that was assigned is 5000 and group is 6000<\/li>\n<li>Create a new folder in the server named &#8220;\/theshare&#8221;<br \/>\n<strong>[root@dcos_bootstrap \/]<\/strong><em><strong> mkdir \/theshare<\/strong><\/em><\/li>\n<\/ul>\n<p>Now mount the Windows share to &#8220;\/theshare&#8221;. The below method is temporary mount. You will have to add entries in fstab to make it permanent.<br \/>\n<strong>[root@dcos_bootstrap \/]<\/strong><em><strong> mount.cifs \\\\\\\\192.168.0.150\\\\myshare \/theshare -o user=user1,pass=&#8221;Smypass&#8221;,uid=5000,gid=6000<\/strong><\/em><\/p>\n<p>Verify if the share got mounted properly<br \/>\n<strong>[root@dcos_bootstrap \/]<\/strong><em><strong> df -h<\/strong><\/em><\/p>\n<p>See if you can view the files stored in Windows share &#8220;<em>\\\\192.168.0.150\\myshare<\/em>&#8221; in the CentOS server&#8217;s folder &#8220;<em>\\myshare<\/em>&#8220;.\u00a0Verify if you can add files in it.<\/p>\n<p><strong>Now let us bring a CentOS container, attaching the folder &#8220;\/theshare&#8221; in the base server to &#8220;\/mnt&#8221; in the container that will be deployed.<\/strong><br \/>\n<strong>[root@dcos_bootstrap \/]<\/strong><em><strong> docker run -v \/lib_core:\/mnt -it centos<\/strong><\/em><\/p>\n<p>Login to the container and see if all the files shared by the Windows server is visible<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>This document helps to mount a folder shared by a Windows server, to a folder in a CentOS container. Share a folder from the Windows <a class=\"mh-excerpt-more\" href=\"http:\/\/shijuvarghese.com\/?p=844\" title=\"Docker: Mounting a Windows File share to a Container\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":730,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,25,3],"tags":[],"class_list":["post-844","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","category-docker","category-linux"],"_links":{"self":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/844","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=844"}],"version-history":[{"count":1,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/844\/revisions"}],"predecessor-version":[{"id":845,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/844\/revisions\/845"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/media\/730"}],"wp:attachment":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=844"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}