[PR #4474] Make cache and metadata directories during Docker build #4262

Open
opened 2026-04-25 00:19:03 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/4474
Author: @mill1000
Created: 7/10/2025
Status: 🔄 Open

Base: masterHead: issue/nonroot_permissions


📝 Commits (3)

  • 8a96d12 Construct cache and metadata directories with global rw permissions
  • 5f628de Define config and metadata paths as VOLUME
  • 2cd975d Format tweak

📊 Changes

1 file changed (+4 additions, -0 deletions)

View changed files

📝 Dockerfile (+4 -0)

📄 Description

Brief summary

Make the cache and metadata directories with global permissions during image creation. This allows the container to run as a non-root user.

Which issue is fixed?

Closes #4471

In-depth Description

By creating the directories during image creation with global permissions non-root users are able to read/write files into them. However, this only works with the default cache and metadata paths. If a user wishes to modify these paths (why?!) they will not be able to run as non-root.

Users using bind mounts will also have to ensure the paths on the host have permissions for the user to access them.

By creating the directories during image creation we also avoid chmoding the directories at runtime so we won't run afoul of #2057

How have you tested this?

Using the docker compose in #4471, I brought the container up from scratch with fresh volumes. If the user attempts to switch from root to a non-root user with existing metadata and cache they might still run into permission issues.

Screenshots


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/4474 **Author:** [@mill1000](https://github.com/mill1000) **Created:** 7/10/2025 **Status:** 🔄 Open **Base:** `master` ← **Head:** `issue/nonroot_permissions` --- ### 📝 Commits (3) - [`8a96d12`](https://github.com/advplyr/audiobookshelf/commit/8a96d12f6973496e249f61c8edf560e937d4bd47) Construct cache and metadata directories with global rw permissions - [`5f628de`](https://github.com/advplyr/audiobookshelf/commit/5f628de64cc07dbdf9e6378b5795c2fb379b75c2) Define config and metadata paths as VOLUME - [`2cd975d`](https://github.com/advplyr/audiobookshelf/commit/2cd975da9da05aea46533299415c267e50fcdaaa) Format tweak ### 📊 Changes **1 file changed** (+4 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `Dockerfile` (+4 -0) </details> ### 📄 Description <!-- For Work In Progress Pull Requests, please use the Draft PR feature, see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for further details. If you do not follow this template, the PR may be closed without review. Please ensure all checks pass. If you are a new contributor, the workflows will need to be manually approved before they run. --> ## Brief summary Make the cache and metadata directories with global permissions during image creation. This allows the container to run as a non-root user. ## Which issue is fixed? Closes #4471 ## In-depth Description By creating the directories during image creation with global permissions non-root users are able to read/write files into them. However, this only works with the default cache and metadata paths. If a user wishes to modify these paths (why?!) they will not be able to run as non-root. Users using bind mounts will also have to ensure the paths on the host have permissions for the user to access them. By creating the directories during image creation we also avoid chmoding the directories at runtime so we won't run afoul of #2057 ## How have you tested this? Using the docker compose in #4471, I brought the container up from scratch with fresh volumes. If the user attempts to switch from root to a non-root user with existing metadata and cache they might still run into permission issues. ## Screenshots <!-- If your PR includes any changes to the web client, please include screenshots or a short video from before and after your changes. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:19:03 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4262