0

I using my Ubuntu docker VM and connected the /var/www/ directory as a volume.

When running the container i'm setting the volume to a local ~/Sites directory.

Inside my Sites directory I have a lot of Symbolic links to other directories.

I allowed Symbolic Links in my configuration file:

<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www

    <Directory /var/www>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

But i keep receiving a permission error, and the apache log says that the Symbolic link is not allowed.

I chown the /var/www -R by www-data user, but I think it has not affect on the directories under the symbolic links...

How can I make them work?

Asaf Nevo
  • 11,338
  • 23
  • 79
  • 154
  • Are you running Docker on OS X? As Docker Toolbox only mounts the user folder to the Docker Machine, symlinks to the outside of the user folder might not work. – Xiongbing Jin Mar 14 '16 at 20:32
  • I am. And o mounted ~/Sites to the container.. And the files in Sites actually works.. So there is no way to symlink it to other folders? – Asaf Nevo Mar 15 '16 at 02:59
  • You can mount another folder to the docker machine, see http://stackoverflow.com/questions/30040708/how-to-mount-local-volumes-in-docker-machine/32030385#32030385, but symlink wont work. – Xiongbing Jin Mar 15 '16 at 03:22
  • What happens is that, your Docker container is not really directly running on top of OS X. They are running inside a virtual machine created by Docker Toolbox. Docker mounts your user folder to this virtual machine by default, so it appears that the container can mount any files/folders inside your user folder. Since symlink goes out of the user folder, the actual files been linked are not available in the virtual machine, thus not useable by your container. – Xiongbing Jin Mar 15 '16 at 03:31

0 Answers0