Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

PetroGromovo's avatar

I got [Errno 13] Permission denied: './docker-compose.yml' running docker

I installed docker on kubuntu 18 , but I got error

$ docker-compose up -d --build
ERROR: .PermissionError: [Errno 13] Permission denied: './docker-compose.yml'

Reading branch https://stackoverflow.com/questions/60025430/docker-error-ioerror-errno-13-permission-denied-docker-compose-yml I tried to salve it :

username@ubuntuOS:/ProjectPath/DOCKER$ sudo groupadd docker
[sudo] password for username:
groupadd: group 'docker' already exists
username@ubuntuOS:/ProjectPath/DOCKER$ sudo gpasswd -a $USER docker
Adding user username to group docker
username@ubuntuOS:/ProjectPath/DOCKER$ docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

username@ubuntuOS:/ProjectPath/DOCKER$ docker-compose logs -f
ERROR: .PermissionError: [Errno 13] Permission denied: './docker-compose.yml'
username@ubuntuOS:/ProjectPath/DOCKER$ sudo dpkg-reconfigure apparmor
Skipping profile in /etc/apparmor.d/disable: usr.bin.firefox
Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
username@ubuntuOS:/ProjectPath/DOCKER$ docker-compose up -d --build
ERROR: .PermissionError: [Errno 13] Permission denied: './docker-compose.yml'
username@ubuntuOS:/ProjectPath/DOCKER$ sudo apparmor_parser -r /var/lib/snapd/apparmor/profiles/snap.docker.compose
username@ubuntuOS:/ProjectPath/DOCKER$ docker-compose up -d --build
ERROR: .PermissionError: [Errno 13] Permission denied: './docker-compose.yml'

But Failed.

My docker-compose.yml :

version: '3.3'

services:

    web:
        build:
            context: ./           # directory of web/Dockerfile.yml
            dockerfile: Dockerfile.yml


        container_name: lar_nginx_web
        # restart: always
        working_dir: /var/www/
        volumes:
            - ../:/var/www


    nginx:
        image: nginx:1.19-alpine
        container_name: lar_nginx_nginx
        # restart: always
        ports:
            - '8084:80'
        # http://127.0.0.1:8000

        volumes:
            - ../:/var/www
            - ./nginx:/etc/nginx/conf.d

    db:
        container_name: lar_nginx_db
        image: mysql:5.7.28
        # image: mysql:8.0.21
        # restart: always
        environment:
            - MYSQL_DATABASE=DockerLarNginx
            - MYSQL_USER=docker_user
            - MYSQL_PASSWORD=4321
            - MYSQL_ALLOW_EMPTY_PASSWORD=false
            - MYSQL_ROOT_PASSWORD=321
            - TZ=Europe/Kiev

        volumes:
            - /var/lib/mysql

    phpmyadmin:
        container_name: lar_nginx_phpmyadmin
        depends_on:
            - db
        image: phpmyadmin/phpmyadmin
        # restart: always
        ports:
            - 8085:80
        environment:
            PMA_HOST: db
            MYSQL_ROOT_PASSWORD: 1

    composer:
        image: composer:2.1
        container_name: lar_nginx_composer
        volumes:
            - ./:/var/www
        working_dir: /var/www
        command: composer install  --ignore-platform-reqs

Project directory :

$ ls -l
total 16
-rwxrwxrwx 1 root root  940 Sep  5 16:39 BySteps.txt
-rwxrwxrwx 1 root root 1561 Sep  5 16:56 docker-compose.yml
-rwxrwxrwx 1 root root 1094 Sep  5 09:15 Dockerfile.yml
drwxrwxrwx 1 root root    0 Sep  2 08:21 nginx
-rwxrwxrwx 1 root root  805 Oct 20  2019 virtualhost.conf

How can it be fixed ?

Thanks!

0 likes
0 replies

Please or to participate in this conversation.