Search code examples
dockerpermissionsdocker-composevirtualboxshared-directory

Permission denied trying `docker-compose build` in virtualbox shared folder


I get .IOError: [Errno 13] Permission denied: './docker-compose.yml' when trying to run docker-compose build inside shared folder from virtualbox. Even if I try it with sudo.

My host machine runs windows 10 and guest OS is ubuntu 18.04.2.

The directory is mounted from virtualbox GUI as permanent, auto-mounted shared folder.

To access this folder I added my user to vboxsf group.

sudo chown -R user /mount/projects has no effect.

UPDATE

Using just a Dockerfile with hello-world and commands docker build --tag=sometag . and docker run sometag works perfectly.

Here is content of my docker-compose.yml:

version: "3"

services:
  build:
    context: .
    dockerfile: ./Dockerfile

Dockerfile is the same with hello-world.

Any ideas?


Solution

  • Fixed by reinstalling docker with:

    sudo apt-get remove docker-ce docker-ce-cli containerd.io
    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo sh get-docker.sh
    sudo apt install docker-compose
    

    And adding my user to gruop docker.