Errno 13 while running docker-compose up

Viewed 7361

I'm building an application using django and I wanted to add docker to this project.

I'm trying to run

sudo docker-compose up

Which gives me this output:

ERROR: .IOError: [Errno 13] Permission denied: './docker-compose.yml'

I checked the permissions using GUI. Everything is fine.

I'm trying to run my app from an mounted drive. I also tested it on other drives. The only drive this problem does not appear is my main drive running Ubuntu 18.04.

Looking forward to some answers

3 Answers

I found a working solution.

Don't use the snap installation and do this instead (tested Ubuntu 20.04)

apt install docker.io docker-compose

adding the directory where I am running my docker-compose.yml using the apparmor reconfigure tool:

$ sudo dpkg-reconfigure apparmor

You need to update your AppArmor configuration :

Snap Dockers are heavily controlled with AppArmor.

To diagnose if it is really the case, check the last lines of the syslog after you triggered the error :

dmesg | grep docker-compose

You should see a snap.docker that was denied:

kernel: [ ] audit: type=1400 audit(....): apparmor="DENIED" operation="exec" profile="snap.docker.dockerd" name="/bin/kmod" pid=7213 comm="exe" requested_mask="x" denied_mask="x" fsuid=0 ouid=0

To correct this, just go to apparmor config's tunables :

cd /etc/apparmor.d/tunables

And edit HOMEDIRS variables in the 'home' file, for example from :

@{HOMEDIRS}=/home/ 

to

@{HOMEDIRS}=/home/ /media/aUser/Linux/

hope that helps.

Related