Docker and Shared Folders by VirtualBox

1

I need a help, guys. My scenario is as follows:

I have Windows 10 installed on my computer. In Windows 10 I installed Virtualbox. In Virtualbox I created a VM and installed Debian. Now, inside Debian, I installed Docker.

In Virtualbox, I've added the share of a Windows folder so that I can access it through Debian. I want to put the projects that I develop in this folder. This way, I will not need to back up the files that are in Debian.

Shared folders between Windows and VM Debian work perfectly Docker works perfectly on my Debian VM. The projects work perfectly, as long as they are not within the shared folder.

This is my problem: if I put project files in the shared folder, I am surprised by lack of access. I have already tried to change the permissions of the shared folder to 777 (everyone has access to everything) but it is not working.

My problem is lack of access. The docker does not have permission to access the shared folder.

How do I resolve this?

    
asked by anonymous 18.01.2018 / 04:07

1 answer

2

Windows and Linux, in addition to not sharing a file system, also do not share a permission policy management system.

Linux has its Unix-derived permissions system, at the time that AT & T began designing it, disk space was expensive, so the system was designed to save every bit of the disk. Each file will have only 3 sets of permissions: access to all, the owner's group and the owner. In order to have more complex permissions guidelines it is necessary to use a different methodology called ACL that is not supported by Linux natively, depending on the installation of new packages. Another problem is that ACL is not implemented in the share that VirtualBox makes available.

Already on windows, the permissions have been taken to the extreme. Each file can have specific permissions for any number of distinct users, groups, and for Everyone. In addition "Everyone" can have different meanings: "All Authenticated Users"; "All visitors"; "All system users"; "All Network Users". To make matters worse, permissions can have inheritance behaviors between folders and child files, among other possibilities.

When a service (such as VirtualBox) shares Windows folders on Linux, it works to make that gap of differences less distant.

As we have seen, because of the nature of the different systems, the modifications made are not mirrored identically in the shared folder in Windows. When we access a share on Linux - or we're using shared Windows credentials among Linux users - or we'll have access access to the share if that user does not have permission.

Docker now takes advantage of Linux kernel innovations: Namespaces, cgroups, SELinux, and UnionFS to be able to share complete systems (containers) for different tasks in order to create isolation between systems. In each container there are several users and groups that can not even exist on the host system!

When you run a container held in a VirtualBox share, you will be exposed to all of these issues, which will make it unusable in its entirety.

I suggest you create a script that runs from time to time (every 10 minutes for example) by compressing and sending the files to windows if you really need to do that.

script.sh:

#!/bin/bash
tar -cpzf /compartilhamento/arquivo.tar.gz pasta_do_conteiner

where -c creates tar -p retains permissions -z compact -f points to output file

crontab -e:

*/10 * * * * /caminho/para/o/script.sh
    
23.01.2018 / 19:19