记录一次docker报错无法访问文件夹,权限错误问题

记录一次docker报错无法访问文件夹,权限错误问题

1. 背景

  1. 使用docker安装photoview,为其分配了一个cache目录,用户其缓存数据。
  2. 在运行过程中,扫描文件后显示如下错误

could not make album image cache directory: mkdir /app/cache

  1. 检查映射的目录,其目录下无任何文件,符合报错内容即无法正确访问文件夹。
  2. 官方github的解答为:

Make sure that your media library's root folder and all the files and

subfolders are readable and searchable by other users: run the next

command (or corresponding sequence of commands from the ):Makefile

make readable If command(s) return error, run them under the user,

owning corresponding files and folders. Alternatively, run them adding

before the command: this will switch the execution context to user and

ask for the root password. You have to have permission to run in the

system.Permission deniedsudo rootsudo

If you don't want to give required permissions to group for your

files, alternatively, you can:others

create a group on your host with GID=999 and make all the files and

folders inside volumes of the service being owned by this group; then

set the appropriate permissions to the section.photoviewgroup create

on your host a group with GID=999 and a user in this group with

UID=999; then change the ownership of all the files and folders inside

volumes of the service to this user; then set the appropriate

permissions to the section.photoviewuser If you configured other

mounts with media files from other locations on the host (like

HOST_PHOTOVIEW_MEDIA_FAMILY or anything else), you need to run the

same commands, as in the target, for each media root folder on your

host manually: copy each command to your shell and replace the

variable with the absolute path to an additional media root folder

without the trailing . Run both commands for each additional root

folder.Makefilereadable/

  1. 官方的方式太复杂了,显示需要创建用户组并将对应的文件夹加入用户组,我不希望这么麻烦。

2. 解决

  1. 主要原因是文件夹的权限,默认是root,将其修改权限,为所有用户可以访问即可。
  2. 如果通过自己的compose安装,默认就是777的权限,但通过unraid进行安装,权限就不是这个。
  3. 修改对应文件夹的权限
cpp 复制代码
chmod -R 777 /mnt/user/appdata/photoview
  1. 修改后重启docker即可正常运行了
相关推荐
我科绝伦(Huanhuan Zhou)1 分钟前
分享一个网络智能运维系统
运维·网络
鬼先生_sir2 分钟前
Spring Cloud 微服务监控实战:SkyWalking + Prometheus+Grafana 全栈解决方案
运维·spring cloud·grafana·prometheus·skywalking
信创DevOps先锋6 分钟前
DevOps工具链选型新趋势:本土化适配与安全可控成企业核心诉求
运维·安全·devops
coppher10 分钟前
Ubuntu 22.04 amd64 离线安装 Docker 完整教程
linux·docker
xyz59923 分钟前
如何在 WSL 中删除指定版本的 Ubuntu 以及安装
linux·运维·ubuntu
linux修理工30 分钟前
Claude code与CC-switch安装使用
运维·人工智能
小叶lr34 分钟前
jenkins打包前端样式丢失/与本地不一致问题
运维·前端·jenkins
Agent产品评测局37 分钟前
互联网行业自动化平台选型,运营全流程提效指南:2026企业级智能体架构与实战全解析
运维·人工智能·ai·chatgpt·架构·自动化
亚空间仓鼠1 小时前
OpenEuler系统常用服务(五)
linux·运维·服务器·网络
minji...2 小时前
Linux 线程同步与互斥(二) 线程同步,条件变量,pthread_cond_init/wait/signal/broadcast
linux·运维·开发语言·jvm·数据结构·c++