14
votes

I have created a docker-compose.yml using cloudestuary. After downloading it and putting it in my Laravel project folder and running docker-compose up -d the download takes place and then I get this message:

ERROR: for worker-1 Cannot start service worker-1: error while creating mount source path '/var/www/html/lensin/html': mkdir /var/www: read-only file system

ERROR: for nginx Cannot start service nginx: error while creating mount source path '/var/www/html/lensin/html': mkdir /var/www: read-only file system

ERROR: for app Cannot start service app: error while creating mount source path '/var/www/html/lensin/html': mkdir /var/www: read-only file system

ERROR: for workspace Cannot start service workspace: error while creating mount source path '/var/www/html/lensin/html': mkdir /var/www: read-only file system ERROR: Encountered errors while bringing up the project.

I`m on Ubuntu 17, and have tried even to set 777 to all folders, and running it with sudo, but the result is the same. I have also tried to move the file and to edit the volumes in yml.

Here is my docker compose file:

version: '2'
services:
    nginx:
        image: 'cloudestuary/nginx:mainline-fpm'
        restart: always
        environment:
            CLIENT_MAX_BODY_SIZE: 100m
            DOCUMENT_ROOT: /var/www/html/public
            INDEX_FILE: index.php
            PHP_FPM: app
        networks:
            - app
        volumes:
            - './html:/var/www/html'
        ports:
            - '80:80'
    app:
        image: 'cloudestuary/php-fpm:7.1'
        restart: always
        environment:
            MAX_UPLOAD_FILE_SIZE: 100m
            APP_URL: 'http://lensin.localhost'
            APP_KEY: 'base64:2X9U1HiBdmfbwvZ4UkwUP/25svg7439HXKWL1F8Xn1c='
            DB_CONNECTION: mysql
            DB_HOST: mysql
            DB_PORT: '3306'
            DB_DATABASE: cloudestuary
            DB_USER: cloudestuary
            DB_PASSWORD: secret
        networks:
            - app
        volumes:
            - './html:/var/www/html'
    workspace:
        image: 'cloudestuary/php-workspace:7.1'
        restart: always
        ports:
            - '2222:22'
        environment:
            MAX_UPLOAD_FILE_SIZE: 100m
            APP_URL: 'http://lensin.localhost'
            APP_KEY: 'base64:2X9U1HiBdmfbwvZ4UkwUP/25svg7439HXKWL1F8Xn1c='
            DB_CONNECTION: mysql
            DB_HOST: mysql
            DB_PORT: '3306'
            DB_DATABASE: cloudestuary
            DB_USER: cloudestuary
            DB_PASSWORD: secret
            SSH_PASSWORD: xsKEVWXPrdAeg
        networks:
            - app
        volumes:
            - './html:/var/www/html'
    worker-1:
        image: 'cloudestuary/php-cli:7.1'
        restart: always
        networks:
            - app
        environment: {  }
        volumes:
            - './html:/var/www/html'
        command: 'php artisan queue:work'
    mysql:
        image: 'mysql:5.7'
        restart: always
        networks:
            - app
        environment:
            MYSQL_ROOT_PASSWORD: toor
            MYSQL_PASSWORD: secret
            MYSQL_USER: cloudestuary
            MYSQL_DATABASE: cloudestuary
        volumes:
            - 'mysql-data:/var/lib/mysql'
volumes:
    mysql-data: {  }
networks:
    app: {  }
4
Looking for read-only file system error in docker might helpAyushya
Check if using volume-nocopy helps or notAyushya
Any fixes found for this issue?HyperionX

4 Answers

23
votes

Remove docker from snap

snap remove docker

Remove the docker directory, and old version (It's okay if these don't exist already)

rm -R /var/lib/docker

sudo apt-get remove docker docker-engine docker.io

Install the official docker package: https://docs.docker.com/install/linux/docker-ce/ubuntu/

14
votes

Restart your docker service. Then the problem will solve.

sudo systemctl restart docker
1
votes

What led me here was the Kubernetes V1VolumeMount. When deploying my application I was getting the same error format:

ERROR: for <pod_name> Cannot start <service_name>: error while creating mount source path '<source_path>': mkdir <dir_path>: read-only file system

At the start I was thinking permissions error as well, hence the message is a bit misleading. I turned out that I was trying to mount something that didn't exist in the source image. Hence, my uneducated suggestion would be, verify that what you are trying to mount does exist, if it doesn't you probably don't need that mount path.

P.S. I saw that there wasn't an accepted answer, so I am hoping that my contribution is not causing unnecessary cluttering.

0
votes

For Docker on Windows 10, sometimes you have just to wait a while (1-5 min) before executing docker-compose up again.

Hope this will help someone else.