title: How can I make symlinks made from inside docker linux containers to be seen from a windows host (maybe involving samba, if needed)
body: <h1>Question</h1>
  
  <p>How can I see symlinks of docker linux-containers from a windows host? (Even if I have to place an intermediate linux machine exposing the filesystem via NFS or Samba)</p>
  
  <h1>Context</h1>
  
  <p>In a DEVEL environment, I have this structure in a certain remote filesystem in a Linux within the office:</p>
  
  <pre><code>/files/repos/app-1
  /files/repos/app-2
  /files/repos/lib-x
  /files/repos/lib-y
  </code></pre>
  
  <p>both <code>app-1</code> and <code>app-2</code> use those libraries which are vendored and symlinked like this:</p>
  
  <pre><code>/files/repos/app-1/vendor/my-company/lib-x =&gt; /files/repos/lib-x
  /files/repos/app-1/vendor/my-company/lib-y =&gt; /files/repos/lib-y
  /files/repos/app-2/vendor/my-company/lib-x =&gt; /files/repos/lib-x
  /files/repos/app-2/vendor/my-company/lib-y =&gt; /files/repos/lib-y
  </code></pre>
  
  <p>The developers need to be in Windows.</p>
  
  <p>So the developers have their IDE pointing to some mounted unit, for example Z:\ where they see all the repos and projects.</p>
  
  <p>This allows us the following:</p>
  
  <ul>
  <li>Edit any of the projects from it's own folder, and run the unit-tests for that project, including running the <code>lib-x</code> and <code>lib-y</code>.</li>
  <li>Develope any of the libraries and have them updated in the depending applications (note I say I am in DEVEL, not PRE or PROD).</li>
  <li>From the IDE, pointing see the "complete structure" of any of the applications (for instance <code>app-1</code>) also see the classes of the <code>lib-x</code> and <code>lib-y</code> so the autocompletion and so works perfectly.</li>
  </ul>
  
  <p>This has been working like this for nearly a decade and works perfectly.</p>
  
  <h1>Problems</h1>
  
  <p>The developers need the connection to the server to develop and we wanted to mutate to local dockers so we can make the devels work from home.</p>
  
  <h1>Going to docker</h1>
  
  <p>We now decided that we are not going to use anymore the office-servers and we are going to setup all the development within docker containers.</p>
  
  <h1>What does actually work</h1>
  
  <p>We just installed docker desktop in Windows and shared C:\repos from the host into the dockers.</p>
  
  <p>We now have some devel machines <code>FROM ubuntu:xxx</code> and run them mounting the volumes.</p>
  
  <p>We made the symlinks within the <code>app-1</code> and <code>app-2</code> to <code>lib-x</code> and <code>lib-y</code> from inside the linux containers.</p>
  
  <p>This does work perfectly and also the repositories work fine if we run the applications in the local dockers</p>
  
  <h1>Problem with symlinks in linux container and windows host</h1>
  
  <p>The problem is now the IDE: While it reads the files in C:\repos\app-1, the symlink that has been created within the linux containers can't be seen from the host.</p>
  
  <p>This makes the IDE to be unable to follow C:\repos\app-1\vendor\lib-x and all the code-completion helpers are broken.</p>
  
  <p>I already know Windows does not support symlink compatible with linux symlinks.</p>
  
  <p>This forces us to look for an alternate solution.</p>
  
  <h1>Solution we've though with Samba</h1>
  
  <p>Initially I thought that as well as in the old topology a linux server just shared the filesystem via samba and the windows could just read the symlinks contents as they were demapped at the serverside and not the clientside, I thought that I could run another docker machine with a samba server just to locally share the "things seen from the linux" into the Windows host again.</p>
  
  <p>To do so, I setup this docker-compose:</p>
  
  <pre><code>version: "3.7"
  services:
      samba:
          container_name: samba
          hostname: samba
          image: dperson/samba
          volumes:
              - //c/Users/xavi/Documents/repos/test_samba:/mount
          ports:
              - "139:139"
              - "445:445"
          command: samba.sh -s "test_samba;/mnt/repos/test_samba;yes;no;yes;all"
          restart: always
  </code></pre>
  
  <p>But this conflicts as 445 is locally already used.</p>
  
  <p>If I turn down the local SMB, then in the next reboot, docker is unable to share C:\ into docker (I was not consciuos it does this sharing via SMB, could it be turned into a NFS or so?)</p>
  
  <p>If I map to another port, like 10445:445 then the client is unable to access it, as client samba ports in windows seem to be not configurable.</p>
  
  <h1>Mapping an IP</h1>
  
  <p>So I tried to map an IP:</p>
  
  <pre><code>version: "3.7"
  services:
      samba:
          container_name: samba
          hostname: samba
          image: dperson/samba
          volumes:
              - //c/Users/xavi/Documents/repos/test_samba:/mount
          ports:
              - "139:139"
              - "192.168.4.83:445:445"
          command: samba.sh -s "test_samba;/mnt/repos/test_samba;yes;no;yes;all"
          restart: always
          networks:
              samba:
                  ipv4_address: 192.168.4.83
  networks:
      samba:
          ipam:
              driver: default
              config:
                  -   subnet: "192.168.4.0/16"
  </code></pre>
  
  <p>But is seems that this still creates problems:</p>
  
  <ul>
  <li>It seems the IP is only for internal docker networking but not seen from the host</li>
  <li>It seems the original service still listens not to 127.0.0.1:445 but to 0.0.0.0:445 so still "blocking" the attachment to listen to 192.168.4.83:445</li>
  </ul>
  
  <h1>So question</h1>
  
  <p>How could I make a windows host to see the "demapped contents of symlinks" to make the IDE see the vendored content that is linked from inside docker linux containers?</p>