Organizr / docker-organizr

Docker image for Organizr
GNU General Public License v3.0
96 stars 12 forks source link

Startup loop on macos #31

Closed foozmeat closed 11 months ago

foozmeat commented 1 year ago

My docker-compose block looks like

  organizr:
    image: organizr/organizr:latest
    container_name: organizr
    environment:
      PUID: ${PUID}
      PGID: ${PGID}
      TZ: ${TZ}
      fpm: true
      branch: v2-develop
    volumes:
        - ./config/organizr:/config
    ports:
      - 8888:80
    restart: unless-stopped

When the container boots I run into the following error

organizr  | -------------------------------------
organizr  | GID/UID
organizr  | -------------------------------------
organizr  | User uid:    501
organizr  | User gid:    501
organizr  | -------------------------------------
organizr  | 
organizr  | 
organizr  | [cont-init.d] 10-adduser: exited 0.
organizr  | [cont-init.d] 20-config: executing... 
organizr  | [cont-init.d] 20-config: exited 0.
organizr  | [cont-init.d] 30-setup: executing... 
organizr  | chown: changing ownership of '/config/www/organizr/.git/objects/pack/pack-9fe38f44429019bc9f2de7378346b06321b2c5c1.idx': Permission denied
organizr  | chown: changing ownership of '/config/www/organizr/.git/objects/pack/pack-9fe38f44429019bc9f2de7378346b06321b2c5c1.pack': Permission denied
organizr  | chmod: changing permissions of '/config/www/organizr/.git/objects/pack/pack-9fe38f44429019bc9f2de7378346b06321b2c5c1.idx': Permission denied
organizr  | chmod: changing permissions of '/config/www/organizr/.git/objects/pack/pack-9fe38f44429019bc9f2de7378346b06321b2c5c1.pack': Permission denied
organizr  | [cont-init.d] 30-setup: exited 0.
organizr  | [cont-init.d] 40-install: executing... 

and then the container restarts and the loop continues. This seems to be caused by using the VirtioFS driver. See this related issue: https://github.com/causefx/Organizr/issues/1907

If 40-install simply didn't try and change permissions on /config I think we could avoid this issue. It seems incorrect to use chown -R abc:abc when we're passing in a preferred UID/GID.

foozmeat commented 1 year ago

I have confirmed that removing the chown line allows the container to startup OK

jejbq commented 1 year ago

Same issue with Docker userns-remap feature and PUID=PGID=33 https://docs.docker.com/engine/security/userns-remap/

...
chown: changing ownership of '/config/php': Operation not permitted
chown: changing ownership of '/config': Operation not permitted
[cont-init.d] 40-install: exited 1.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.
...
Roxedus commented 11 months ago

should now soft-fail if it cannot change perms.