I'm working on a test server, on my computer. Where I have installed Ubuntu server, as a VM in virtual-box.

Version 5.2.8.r121009

Specs:

  • Ubuntu 17.10 4.13.0-21-generic
  • Docker version 18.04.0-ce, build 3d479c0

I have created two Shared folders.

root@docker:/var/lib/docker# ls /media/ -l
totalt 4
drwxr-xr-x 2 root root   4096 mai    8 23:15 cdrom
drwxrwx--- 1 root vboxsf    0 mai    8 23:46 sf_docker-compose
drwxrwx--- 1 root vboxsf    0 mai    9 00:17 sf_docker-volumes 

When I do

service docker stop && \
rm -fr /var/lib/docker/volumes && \
ln -s /media/sf_docker-volumes /var/lib/docker/volumes && \
service docker restart && \
docker ps

I get the following error

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. 
Is the docker daemon running?

So i revert back, to the defaults:

service docker stop && \
rm -fr /var/lib/docker/volumes && \
service docker restart && \
docker ps

And everything is working again.

So my questions is, how can i fix the permissions issues i get from using a symlink for the /var/lib/docker/volumes/ folder. Im sure that the issue is that the group owner of the symlink is vboxsf and not root. but i cant seem to manage to change that .

To change the ownership of your symbolic link try the following command and see if it fixes your problem. A sudo might be needed.

 chown -H myuser:mygroup mysymbolic
  • I have tried this also, its does not resolve the issue. – BD Bear May 13 at 14:17

After a lot of trail and error, i have found out that what i'm trying to do. is not possible. at-least not in a direct way. The file system, that virtual-box use for it shared folders, is read only for the system, but for users its read-write. (why i haven't figured out.)

What i want is a seamless experience, where i don't have to manually copy and paste the files, but that for the life of me I cant figure out how to do.

The only thing close to a working solution, are to edit my fstab file, and add the mount there.

docker /docker    vboxsf  defaults,uid=1000,gid=1000,umask=0022   0       0

then create ascript that does this for me

rm -fr /docker/* && \
mkdir /tmp/docker && \
cp -r /var/lib/docker/volumes/* /tmp/docker &&\
sudo chown -H bdbear:bdbear /tmp/docker && \
mv /tmp/docker/* /docker

This does half of the job for me, so its okey. but an automatic solution would be so much more easier.

Perhaps i will implement Inotify-tools to make this fully automatic, But for now i have just scraped the whole idea of working on this small project. I tried using Rsync but it gives me a protocol error, related to read-only file-system.

  • its worth mention that i tried docker /docker vboxsf defaults,uid=0,gid=0,umask=0022 0 0 during my time of troubleshooting, but it was not giving me a working solution. – BD Bear May 13 at 17:35

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.