Docker Community Forums

Share and learn in the Docker community.

Symlinks on shared volumes not supported

when you say ‘I use the following mount options’, can you elaborate how you did configure those on your setup please?

In the docker daemon configuration of the Docker for Windows or in your docker-compose file or docker container/volume creation?

Thanks a lot

I haven’t tried to use it with docker yet, i just saw this thread on connecting through SMB and had some extensive experience when creating our Vagrant development box so just gave my 2 cents.

I’m not sure if you can give mount options when creating a docker container with Docker for Windows. The thing is, this would be Windows specific, and therefor might not be available as a flag.

Thanks @bbrala for the info.

@rneugeba, any timeframe as when the mfsymlinks integration will be at least started? Or is there a workaround to get this scenario working?

Thank you very much

2 Likes

Just curious how this is going? I like many others are wondering if we should entertain one of the work arounds suggested above or wait? What kind of time frame are we looking at for symlinks to work on NTFS? Thank you!

Check this out https://github.com/gboudreau/Greyhole/wiki/CreateSymlinks

Also looking for a solution for this to run an apache app.

I experimented a bit and found that you can create symlinks in windows (mklink /d x y) and those symlinks do work in the docker container. You can navigate through them and create files under the link path. What doesn’t work is the ability to create links from the container. But if you can make do by creating all your links from the windows side that might work for you.

1 Like

Hopefully this will be in beta22 which is slated for next week (week starting 8/8/2015).

7 Likes

I installed the Docker for Windows Beta from here. My npm install command worked when using the local directory syncing. So awesome!

2 Likes

8/8/2015? this is really confusing, do you mean 8/8/2016?

Yes, sorry about that: https://docs.docker.com/docker-for-windows/release-notes/#/beta-23-release-2016-08-16-1-12-1-rc1-beta23

I’m not sure if I’m having the same issue as @barnumd but could be related.

I’m using the latest Beta 26 on Windows 10 1607, If I use MKLINK /D test C:\Users and then run docker run --rm -v C:/Code/docker/research/test:/data alpine ls /data I get the following error.

C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: mkdir /C/Code/docker/research/test: file exists.

If I use MKLINK /J test2 C:\Users and then run docker run --rm -v C:/Code/docker/research/test2:/data alpine ls /data then I get the full directory listing.

It would seem that junctions are working correctly but symlinks aren’t. The problem I have with this is that I need to use symlinks since the data I’m sharing with the container resides on a network drive forcing me to use symlinks instead of junctions.

Docker for Windows Beta definitely fixed all the issues I was having with npm install on a shared mounted volume. Awesome!

Symlinks on bind mounted volumes are still not working in latest beta for me. They show up in windows as files rather than links and show up as corrupt files in any other containers you mount them in.

Using docker-machine with virtualbox driver this is working (currently my only option).

Not sure if this helps, but instead of using a symlink I added a mount point for a separate drive I want to use under %Userprofile%\Docker using the Disk Management console. Docker seemed to be happy using these folders.

1 Open Disk Management Console
2 Right click on partition / drive you want to use for docker content
3 Click Change Drive Letter and Paths
4 Click Add
5 Select “Mount in the following empty NTFS folder”, and click Browse
6 Navigate to your user folder and select / create a folder to mount under
7 Click OK OK

You can now use this folder which is mapped to the separate partition

1 Like

Verified here on windows 10 professional we are definitely all Fixed. Now able to do all sorts of amazing things with Windows + Docker + Linux containers where i share a file system with windows. Excellent work!!!

Hi! I’m experiencing this problem with Docker ToolBox under Windows 7. Any ideas if it’s considered to be fixed? Related issues are already closed.

anyway, I’ll try other options as some mentioned, like running mklink /d from windows.

Thanks!! byee

The error is
symlink(): Read-only file system

And my current environment details:
Win 7 Ultimate SP 1

$ docker version
Client:
Version: 17.10.0-ce
API version: 1.33
Go version: go1.8.3
Git commit: f4ffd25
Built: Tue Oct 17 19:00:02 2017
OS/Arch: windows/amd64

Server:
Version: 17.11.0-ce
API version: 1.34 (minimum version 1.12)
Go version: go1.8.5
Git commit: 1caf76c
Built: Mon Nov 20 18:39:28 2017
OS/Arch: linux/amd64
Experimental: false

VirtualBox 5.2.0 r 118431

Edit: Running mklink /d from outside the container works. I ran it from the windows command line and with administrative privileges

I had success using the handy Link Shell Extension tool and using ‘Junction’ as link type.

In case you are using this for developping on a WordPress plugin which original directory is outside the WordPress site: Be aware that composer could nuke the plugin directory and also the original plugin directory when you manage your plugin/themes using composer (e.g. roots Bedrock installation).

1 Like

@friism Hi, updates ?
Soft symlinks work fine when created through the Windows host machine (either through bash.exe or WSL) and show up correctly on containers/VMs, but symlinks created inside containers appear as text files on the Windows host machine. Why ? Any fix that will make Windows/WSL recognize those symlinks as pointers rather than text files ? If adding mfsymlinks option to SMB3 client, allows it to read symlinks correctly, there is no reason why Windows cannot interpret them as symlinks.

Symlinks created by Windows host machine (WSL/Bash.exe/cmd.exe)::

  • • Windows (WSL or Cygwin Bash.exe) - :heavy_check_mark:️ symlink works
  • • Docker container - :heavy_check_mark:️ symlink works
  • • Hyper-V VM - :heavy_check_mark:️ symlink works

Symlinks created by Docker containers::


Its 2 years already, is there a solution for making containers symlinks compatible with Windows Subsystem for Linux or Cygwin Bash ?
Use case: I’m installing node_modules from both WSL side and Docker containers side. In WSL host machine, the container’s node_modules/.bin symlinks appear as text files rather than pointers.

This issue made me a lot of headaches, will switching to Linux host development setup remove the need for all these workaround ?


Docker Version
  • Windows 10 Pro 1803, OS build 17134.345, Developer mode turned on.
  • WSL Debian GNU/Linux 9.5 (stretch)
  • Docker for Windows 2.0.0.0-beta1-win75 (19925) edge 915f68b
  • MobyLinuxVM kernel 4.9.125-linuxkit
  • Docker Engine : 18.09.0-ce-beta1
  • Container - any Linux container.
  • Hyper-V VM Ubuntu 18.04.1

For both way working symlinks use nfs. It is faster and support symlinks.
I know a least two nfs servers for windows which I tested for working symlinks:
nfs4j - https://github.com/gfi-centre-ouest/nfs4j-daemon/releases
haneWIN - https://www.hanewin.net/nfs-e.htm

p.s.: tested with npm, git and webpack on windows 10 host and archlinux container

here is a part of my docker-compose.yml config with nfs volume

volumes:
  projects:
    driver: local
    driver_opts:
      type: nfs
      o: addr=192.168.1.102,vers=4.1
      device: ":/projects"

are you talking to create docker volume , then mount to Linux container? or mount a host volume to Linux container, then checkout code to the mount point and make build inside the container?