Ubuntu – Getting “Protocol Error” when trying to create a symlink in Docker

dockersymlinkUbuntuvirtual machinewindows

I'm trying to setup a symlink, using the command

ln -s /var/www/data/cache/widget/overlay/ /var/www/public_html/images/overlay

but it outputs

ln: failed to create symbolic link '/var/www/public_html/images/overlay': Protocol error

The host OS is Windows 8, and the Docker image is Ubuntu. I believe the issue could be something to do with permissions, as when the Docker image is started, /var/www/public_html is mapped to a folder inside Windows 8, /C/Users/Username/Documents/development/public_html. However, I can create folders, and files via command line inside the public_html folder, which kind of goes against it being permissions.

I also can't find anyway to start Docker as admin to see if that helps, as it's just a .sh script that runs.

Has anybody else had the "Protocol error" when creating symlinks? Or any idea how I could get more information about what causes this issue?

EDIT: Also, if I try to save an image via PHP to the public_html folder or copy a file there (again, via PHP), that gives the same "Protocol error" message.

Best Answer

So /var/www/public_html is actually a Windows folder, but /var/www/data is not?  You're trying to create a symbolic link from a Windows directory into a Ubuntu directory in a virtual machine.  There's no way that Windows can support an object like that.

To expand on the above: I guess the point is that the Windows host is set up as a file server, making C:\Users\Tom_Hart\Documents\development\public_html available to clients — specifically, giving read/write access to the Ubuntu image, so Ubuntu can read, modify, and create objects in and under that Windows directory.  But, in general, servers don’t have visibility into their clients (How would you feel if Google started indexing your files and returning them in search results?)  Unless the Docker image is exporting its files, Windows has no way to access /var/www/data — or even to understand such a path; e.g.,

    C:\Users\Tom_Hart\Documents> notepad /var/www/data/cache/widget/overlay/something

won’t work (it might think you mean C:\var\www\data\cache\...).  It seems natural that Windows will refuse to create a symbolic link, in a Windows directory, to a resource that cannot be accessed by Windows processes.

Related Question