<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Zdravko Tyankov</title>
    <description>The latest articles on Forem by Zdravko Tyankov (@ztyankov).</description>
    <link>https://forem.com/ztyankov</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F118307%2F83b12259-135f-45a8-b765-dae8cfe3e8ce.jpeg</url>
      <title>Forem: Zdravko Tyankov</title>
      <link>https://forem.com/ztyankov</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ztyankov"/>
    <language>en</language>
    <item>
      <title>Fix Docker Invalid Mount Path Issues on Windows 10</title>
      <dc:creator>Zdravko Tyankov</dc:creator>
      <pubDate>Sun, 03 May 2020 16:16:01 +0000</pubDate>
      <link>https://forem.com/ztyankov/fix-docker-invalid-mount-path-issues-on-windows-10-2d1l</link>
      <guid>https://forem.com/ztyankov/fix-docker-invalid-mount-path-issues-on-windows-10-2d1l</guid>
      <description>&lt;p&gt;First of all, Niall Maher's article was an awesome introduction to getting up and running with Docker via Remote Containers in VSCode! It made me want to try out Docker for my webdev setup as well. &lt;/p&gt;
&lt;div class="ltag__link"&gt;
  &lt;a href="/nialljoemaher" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xFQrlcZa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--cQynSLX1--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_150%2Cq_auto%2Cw_150/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/166066/a7a8eb44-79dd-4845-a4e5-a1479fddfc46.png" alt="nialljoemaher image"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/nialljoemaher/dockerize-your-development-environment-1a50" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Dockerize your Development Environment&lt;/h2&gt;
      &lt;h3&gt;Niall Maher ・ Apr 15 ・ 3 min read&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#docker&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#vscode&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#plugins&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;
 

&lt;p&gt;Once I finished reading the article, I really wanted to test it out on my own. But things didn't work out right out of the box for me... &lt;/p&gt;

&lt;p&gt;The official &lt;a href="https://code.visualstudio.com/docs/remote/containers#_installation"&gt;VSCode Remote Containers&lt;/a&gt; documentation leads off with installing &lt;code&gt;Docker Desktop&lt;/code&gt;. It turns out that my version of Windows (10 Home) is not supported, because it lacks the &lt;code&gt;Hyper-V&lt;/code&gt; and &lt;code&gt;Containers Windows&lt;/code&gt; features. (Minimum requirements: Windows 10 Pro/Enterprise). &lt;/p&gt;

&lt;p&gt;So to get things running, I had to install the now &lt;em&gt;unsupported Docker Toolbox&lt;/em&gt;, thinker with the settings a little bit and enjoy me some Docker containers. If anyone else encounters any folder binding/mounting issues, here is what I had to do...&lt;/p&gt;
&lt;h2&gt;
  
  
  Installing Docker Toolbox
&lt;/h2&gt;

&lt;p&gt;Please follow this guide for downloading and installing the &lt;a href="https://docs.docker.com/toolbox/toolbox_install_windows/#step-2-install-docker-toolbox"&gt;Docker Toolbox&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Don't forget to verify your installation, like running the Docker Quickstart Terminal!&lt;/p&gt;
&lt;h2&gt;
  
  
  Mount Binding Issues on Windows
&lt;/h2&gt;

&lt;p&gt;Mounting the proper host folder and using it inside the Docker dev container was the biggest hurdle in my setup. I'm sure that this works like a charm on Linux and probably MacOS, but there were some issues on Windows...&lt;/p&gt;

&lt;p&gt;This is the error that I encountered multiple times during the container building process:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;C&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;Program&lt;/span&gt; &lt;span class="nx"&gt;Files&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;Docker&lt;/span&gt; &lt;span class="nx"&gt;Toolbox&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;docker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exe&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="nx"&gt;daemon&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;invalid&lt;/span&gt;
&lt;span class="nx"&gt;mount&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bind&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;invalid&lt;/span&gt; &lt;span class="nx"&gt;mount&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;d:/my-projects/test-docker-project&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="nx"&gt;mount&lt;/span&gt;
&lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="nx"&gt;must&lt;/span&gt; &lt;span class="nx"&gt;be&lt;/span&gt; &lt;span class="nx"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;There is a lot of information about how to address this issue, but most of it was related to setting &lt;code&gt;MSYS_NO_PATHCONV=1&lt;/code&gt; environment variable when launching Docker &lt;a href="https://github.com/docker/toolbox/issues/673#issuecomment-355275054"&gt;GitHub Source&lt;/a&gt;. That was already applied in my environment though and things didn't work out of the box. So I had to find another way to mount my project folder through VirtualBox.&lt;/p&gt;

&lt;h3&gt;
  
  
  Add Your Project Folder(s) to VirtualBox
&lt;/h3&gt;

&lt;p&gt;Docker Toolbox works through VirtualBox. A version of VirtualBox comes with your Docker Toolbox installation, so you don't have to worry about that. Once you have things installed, you need to do the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open &lt;em&gt;Oracle VM VirtualBox&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Find and select the VM that was created by Docker (usually called &lt;code&gt;default&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Open the Settings for that Virtual Machine (Gear Icon - Settings)&lt;/li&gt;
&lt;li&gt;Select &lt;code&gt;Shared Folders&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Select &lt;code&gt;Machine Folders&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Click the &lt;code&gt;+&lt;/code&gt; sign to add a new folder:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Folder path&lt;/code&gt;: select your project code folder (Example: &lt;code&gt;d:\my-projects&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Folder name&lt;/code&gt;: the name of the folder that will appear in your container. (Example: &lt;code&gt;my-projects&lt;/code&gt;). You'll use this folder name again, so write it down :-)&lt;/li&gt;
&lt;li&gt;Check &lt;code&gt;Auto-mount&lt;/code&gt; &amp;amp; &lt;code&gt;Make Permanent&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Click OK.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Click OK to save the settings. Note: The newly mounted folder should apply without a VM reboot.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Update VSCode devcontainer.json Options
&lt;/h3&gt;

&lt;p&gt;Now we need to map the newly mounted folder from the VirtualBox VM to a folder inside of our Docker container. To do that, we need to make some changes to our devcontainer.json file:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;source&lt;/strong&gt;: /my-projects/test-docker-project&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;target&lt;/strong&gt;: /workspace&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is how that looks in devcontainer.json:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"workspaceMount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"source=/my-projects/test-docker-project,target=/workspace,type=bind,consistency=relegated"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"workspaceFolder"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/workspace"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;After making these changes to your &lt;em&gt;devcontainer.json&lt;/em&gt; file you'll have to rebuild your container (&lt;em&gt;Remote-Containers: Rebuild Container OR Remote-Containers: Rebuild and Reopen Folder in Container&lt;/em&gt;).&lt;/p&gt;

&lt;p&gt;Now you should be ready to go! &lt;/p&gt;

&lt;p&gt;Let me know if you encountered this or other problems in your Docker setup and how you were able to fix them.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>dockertoolbox</category>
      <category>vscode</category>
      <category>windows10</category>
    </item>
  </channel>
</rss>
