Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container startup only works with bind mount; cp: can't create directory '/var/www/app/storage/app': Permission denied #558

Open
ToshY opened this issue Jan 17, 2024 · 5 comments

Comments

@ToshY
Copy link

ToshY commented Jan 17, 2024

Setup information

docker compose v2.24.0

Describe the bug

It's not possible to setup the application using docker volumes with the example config provided, as it throws the following error in the container logging:

invoiceninja-1   | 2024-01-17T17:48:47.208852859Z cp: can't create directory '/var/www/app/storage/app': Permission denied
invoiceninja-1   | 2024-01-17T17:48:48.206288663Z cp: can't create directory '/var/www/app/storage/app': Permission denied
invoiceninja-1 exited with code 1

This is similar to #330 , but because I'm not using bind mount but volumes I cannot perform chmod / chown operations, as the volumes are manager by docker.

To reproduce
Steps to reproduce the behavior:

  1. Use fresh docker-compose.yml (or something similar)
  2. For the app service change the following volumes.

from

services:
  app:
    volumes:
      - ./docker/app/public:/var/www/app/public:rw,delegated
      - ./docker/app/storage:/var/www/app/storage:rw,delegated

to

services:
  app:
    volumes:
      - app_public:/var/www/app/public:rw,delegated
      - app_storage:/var/www/app/storage:rw,delegated

volumes:
  app_public:
    driver: local
  app_storage:
    driver: local
  1. Up the services.
  2. Check logging of app container throwing the error.

Also tried using user: root and user: 1500 on app service, which both result in similar error in UI.

image

Expected behavior

Able to use volumes instead of bind mounts.

Docker:

  • Output of docker version:
Client: Docker Engine - Community
 Version:           24.0.5
 API version:       1.43
 Go version:        go1.20.6
 Git commit:        ced0996
 Built:             Fri Jul 21 20:35:18 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          24.0.5
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.6
  Git commit:       a61e2b4
  Built:            Fri Jul 21 20:35:18 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.22
  GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca
 runc:
  Version:          1.1.8
  GitCommit:        v1.1.8-0-g82f18fe
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Additional context
invoiceninja/invoiceninja: 5.8.10

@ToshY
Copy link
Author

ToshY commented Feb 4, 2024

Possible duplicate items #330, #289, #194

Helpful Links:

Yes this is most likely related to #194 , however I'm not convinced that manually chowning the volume in /var/lib/docker directory is an appropriate solution.

@ryangurn
Copy link

ryangurn commented Feb 5, 2024

@ToshY i think that recommendation was updated and put the in read me... might want to check that.

@litecactus
Copy link

running docker in rootless mode I still get this error even after the additional permission step as suggested. My UID is 1000 so I also tried that (assuming that that is what the 1500 is?)

chmod 755 docker/app/public
sudo chown -R 1500:1500 docker/app

@javydreamercsw
Copy link

Just tried today after finding this for the first time and ran into this. Nothing suggested seems to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants