aboutcode-org / dejacode

Automate open source license compliance and ensure software supply chain integrity
https://dejacode.readthedocs.io
GNU Affero General Public License v3.0
25 stars 8 forks source link

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

Open jelhan opened 3 months ago

jelhan commented 3 months ago

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 git@github.com: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.):