记录一次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即可正常运行了
相关推荐
刘若水1 小时前
Linux: 进程信号初识
linux·运维·服务器
小刘爱喇石( ˝ᗢ̈˝ )1 小时前
玛卡巴卡的k8s知识点问答题(六)
云原生·容器·kubernetes
rider1891 小时前
【1】搭建k8s集群系列(二进制部署)之系统初始化
云原生·容器·kubernetes
阳小江2 小时前
Docker知识点
运维·docker·容器
极客柒3 小时前
RustDesk 开源远程桌面软件 (支持多端) + 中继服务器伺服器搭建 ( docker版本 ) 安装教程
服务器·docker·开源
只是橘色仍温柔3 小时前
xshell可以ssh连接,但vscode不行
运维·vscode·ssh
IT里的交易员3 小时前
【系统】换硬盘不换系统,使用WIN PE Ghost镜像给电脑无损扩容换硬盘
运维·电脑
共享家95273 小时前
深入剖析Linux常用命令,助力高效操作
linux·运维·服务器
小刘爱喇石( ˝ᗢ̈˝ )3 小时前
玛卡巴卡的k8s知识点问答题(七)
云原生·容器·kubernetes
大刘讲IT3 小时前
制造业数字化转型:流程改造先行还是系统固化数据?基于以MTO和MTS的投资回报分析
运维·经验分享·生活·产品经理·数据可视化