Skip to content

fix(docker): make configureNextcloud work with bind mounted apps - #1063

Open
luflow wants to merge 1 commit into
nextcloud-libraries:mainfrom
luflow:fix/noid/bind-mounted-apps
Open

fix(docker): make configureNextcloud work with bind mounted apps#1063
luflow wants to merge 1 commit into
nextcloud-libraries:mainfrom
luflow:fix/noid/bind-mounted-apps

Conversation

@luflow

@luflow luflow commented Jul 26, 2026

Copy link
Copy Markdown

Problem

configureNextcloud() currently aborts on main as soon as an app is bind mounted into apps-writable (which startNextcloud(branch, true) does by default):

chown: changing ownership of '/var/www/html/apps-writable': Operation not permitted

Docker pre-creates the bind mount target as root, but runExec defaults to www-data, which may not chown it.

After fixing that, the next call fails too:

[cause]: { stdout: 'attendance already installed\n', stderr: '', exitCode: 1 }

app:list is queried before apps.config.php registers apps-writable as an apps path, so the mounted app is missing from the list. It is then not found in shipped.json either and ends up in the app store branch, where app:install --force exits non-zero with "already installed".

Both were introduced together with the apps-writable handling; the repo's own test suite passes mountApp: false, so neither is covered.

Fix

  • run mkdir/chown for apps-writable as root (same as the existing data directory handling in startNextcloud)
  • build the app list only after apps.config.php has been written

Testing

  • npm run lint, npm run build, npx tsc --noEmit – clean
  • npm run test:node – 4/4 pass (unchanged behaviour, mountApp: false)
  • Manually against a bind mounted app (nextcloud/attendance, stable34, macOS + Docker Desktop): configureNextcloud now completes and reports attendance 1.41.2 enabled instead of aborting.

Not verified: whether the chown also failed on Linux runners – this is the one platform dependent spot in the change, and I only had macOS + Docker Desktop available.

Docker pre-creates `/var/www/html/apps-writable` as root when an app is bind
mounted into it, so the `chown` handing the directory to `www-data` has to run
as root as well. Without it `configureNextcloud` aborts with
"chown: changing ownership of '/var/www/html/apps-writable': Operation not
permitted".

The app list also has to be built after `apps.config.php` registered
`apps-writable` as an apps path, otherwise mounted apps are missing from it and
are then installed from the app store, which fails with "<app> already
installed".

Signed-off-by: Florian Ludwig <florian@krautnerds.de>
@luflow
luflow force-pushed the fix/noid/bind-mounted-apps branch from 2bffbd8 to 1534520 Compare July 28, 2026 16:02
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

Successfully merging this pull request may close these issues.

1 participant