1

I am trying to dockerise my laravel site. I am on Windows 10 and the docker toolbox doesn't work quite well for me (relative path doesn't mount well).

So, I have decided to setup a Virtualbox Ubuntu 16.x server and install docker CE inside the VM. Then I've added my C:\Projects on my windows host machine as a shared folder into my Ubuntu VM. Then within my VM, I've installed the Guest Additions, so that the shared folder would appear in my VM under /media/sf_Projects/

Lastly, I've added my non-root account latheesan to the vboxsf using this command: sudo adduser latheesan vboxsf and created a symbolic link to /media/sf_Project to /home/latheesan/Projects (for easy access).

After rebooting the Ubuntu VM, I could access the shared folder contents as latheesan user.

So, I cloned my project on my host machine into: C:\Projects\mysite.io dir.

Then I ssh'ed into my Ubuntu virtualbox VM (running Docker CE) and ran my docker-compose build && docker-compose up -d command. Everything worked and the containers were up. When I visited my site running in the docker container, I am getting this error from apache:

Forbidden You don't have permission to access / on this server.

So, I started an interactive shell into my container and it looks like the site directory is mounted as root, not www-data. Perhaps this is why the error.

Here's all the logs from my operation on my host machine & container: https://pastebin.com/raw/M7Jq0CgP

This is my setup:

Any ideas why the volume is not mounting as www-data? or is this not possible using windows host machine + virtual box vm + docker ce?

Latheesan
  • 347
  • 2
  • 6
  • 18

1 Answers1

0

From the Virtualbox docs:

[...] the default mount options are used and all files are owned by root. This can be changed by adding some mount options. Options are passed on with the -o parameter. You can use multiple options with one parameter, seperate the values with a comma. See the man page of mount for more info on which options you can use. The User Manual also notes the options compatible with the Shared Folders. To mount the SF so that you are the owner of the files, use this command:

sudo mount -t vboxsf -o rw,uid=1000,gid=1000 share ~/host