vexE
vexE

Reputation: 301

Errno 13 while running docker-compose up

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

Upvotes: 15

Views: 11108

Answers (4)

Sebinn Sebastian
Sebinn Sebastian

Reputation: 194

All the other answers didn't work for me.

docker --version

Docker version 20.10.17, build 100c701

docker-compose -v

docker-compose version 1.29.2, build unknown

Instead of

docker-compose up

please use

docker compose up

Upvotes: 3

Anders
Anders

Reputation: 567

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

Upvotes: 10

François Menet
François Menet

Reputation: 71

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.

Upvotes: 4

Don Giulio
Don Giulio

Reputation: 3304

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

$ sudo dpkg-reconfigure apparmor

Upvotes: 10

Related Questions