Getting "Protocol Error" when trying to create a symlink in Docker

7,834

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.

Share:
7,834

Related videos on Youtube

TMH
Author by

TMH

Updated on September 18, 2022

Comments

  • TMH
    TMH over 1 year

    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.

  • TMH
    TMH about 9 years
    Yeah that's right. It's mounted as a data volume using this, ` -v /c/Users/TomHarto/Documents/development/public_html:/var/www‌​/public_html \ `. I thought it could be because it's a mounted dir, but I was hoping there was a way around it.
  • TMH
    TMH about 8 years
    Apologies for the delayed accept!
  • Starx
    Starx over 7 years
    How can we check if symlink can be created as such?
  • Scott - Слава Україні
    Scott - Слава Україні over 7 years
    @Starx: I expanded on my original answer; I hope that clarifies matters.
  • Starx
    Starx over 7 years
    Thank you for adding that explanation. It's less helpful to me in particular as I want to check through command if symlinks on a path can be created or not. Have a look. unix.stackexchange.com/questions/317881/…