invoiceninja / dockerfiles

Docker files for Invoice Ninja
https://hub.docker.com/r/invoiceninja/invoiceninja
GNU General Public License v2.0
412 stars 267 forks source link

Podman - Premissions issue, unable to create directory #512

Open piyushpaliwal opened 1 year ago

piyushpaliwal commented 1 year ago

Setup information I am trying to run rootless with podman. Here is my docker-compose setup

version: "3.7"

services:
  app:
    image: docker.io/invoiceninja/invoiceninja:5
    volumes:
      - /opt/invoiceninja/app/public:/var/www/app/public:z
      - /opt/invoiceninja/app/storage:/var/www/app/storage:z
    depends_on:
      - db
    environment:
      - APP_ENV=production
      - APP_DEBUG=0
      - APP_URL=http://localhost:8003
      - APP_KEY=<redacted>
      - APP_CIPHER=AES-256-CBC
      - DB_HOST=db
      - DB_DATABASE=ninja
      - DB_USERNAME=ninja
      - DB_PASSWORD=ninja
      - DB_PORT=3306
    ports:
      - "8003:80"

  db:
    image: docker.io/mysql:8
    ports:
      - "3305:3306"
    volumes:
      - /opt/invoiceninja/mysql/data:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=<redacted>
      - MYSQL_USER=ninja
      - MYSQL_PASSWORD=ninja
      - MYSQL_DATABASE=ninja

networks:
  default:
    external:
      name: npm-proxy-manager_default

As I have read in the various issues here, the common ask is to ensure permissions are set as per the readme. Here is the output of ls -l

drwxrwxr-x 4   1500   1500 4096 May  7 08:54 app
-rw-rw-r-- 1 osuser osuser  943 May  7 08:53 docker-compose.yml
drwxrwxr-x 3 osuser osuser 4096 May  7 08:43 mysql

ls -l app

total 8
drwxr-xr-x 2 1500 1500 4096 May  7 08:53 public
drwxrwxr-x 2 1500 1500 4096 May  7 08:54 storage

I would assume the permissions are sorted for this.

Describe the bug Upon starting containers, the app container exists immediately, and below are the logs

cp: can't create directory '/var/www/app/storage/app': Permission denied

Expected behavior I was hoping to get invoiceninja started and served on http://localhost:8003

Docker/Kubernetes/Helm:

flortsch commented 9 months ago

Adjust the docker-compose.yml file and add userns_mode: keep-id:uid=1500 to the app section (1500 is the uid of the internal container user, the instruction tells podman to map your host user to the container user).