dejacode icon indicating copy to clipboard operation
dejacode copied to clipboard

BUG: docker-compose tries to bind mount folders from root machine

Open jelhan opened this issue 1 year ago • 0 comments

Describe the bug

docker compose up fails with the following error when I run it on my local machine:

error while creating mount source path '/var/www/html': mkdir /var/www: read-only file system

The error is caused by the nginx service. I can reproduce it with docker compose up nginx as well. There isn't any additional information in the log:

$ docker compose up nginx
[+] Running 6/6
 ✔ Network dejacode_default     Created                                                                                                                                       0.1s 
 ✔ Container dejacode-clamav-1  Created                                                                                                                                       0.1s 
 ✔ Container dejacode-db-1      Created                                                                                                                                       0.1s 
 ✔ Container dejacode-redis-1   Created                                                                                                                                       0.1s 
 ✔ Container dejacode-web-1     Created                                                                                                                                       0.1s 
 ✔ Container dejacode-nginx-1   Created                                                                                                                                       0.0s 
Attaching to nginx-1
Gracefully stopping... (press Ctrl+C again to force)
Error response from daemon: error while creating mount source path '/var/www/html': mkdir /var/www: read-only file system

I tested with v5.1.0 and latest main branch (956a80790d41a3cf44a51869a9b1eadca55fc2ac). I'm seeing the same error for both.

Investigation

DejaCode's Docker Compose setup bind mounts to paths on the machine hosting the containers: https://github.com/nexB/dejacode/blob/956a80790d41a3cf44a51869a9b1eadca55fc2ac/docker-compose.yml#L74

On my machine the folder /var/www does not exist. The user under which docker runs doesn't seem having permissions to create it.

To Reproduce

Ensure that user under which docker runs does not have access permissions writing to /var/www.

  1. git clone [email protected]:nexB/dejacode.git
  2. git checkout v5.1.0
  3. docker compose build
  4. docker compose up

Expected behavior

docker compose up should start DejaCode as long as the machine has a working Docker setup. It should not rely on the machine's file system.

Screenshots

n.a.

Context (OS, Browser, Device, etc.):

  • Docker version 27.1.1, build 6312585
  • Docker Compose version v2.29.1
  • Ubuntu 23.10

jelhan avatar Aug 02 '24 11:08 jelhan