记录一次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即可正常运行了
相关推荐
blackorbird几秒前
AI工作流自动化平台n8n正被大规模网络武器化
运维·网络·人工智能·自动化
Fcy648几秒前
Linux下 进程控制(二) —— 进程程序替换
linux·运维·服务器
浮尘笔记1 分钟前
Java Snowy 框架生产环境安全部署全流程(服务器篇)
java·运维·服务器·开发语言·后端
web守墓人2 分钟前
【linux】Mubuntu v1.0.10更新日志
linux·运维·服务器
赵钰老师9 分钟前
最新Hermes Agent 技能封装与科研自动化:以 Meta-Analysis 为例-实现从文献检索到绘图的一站式工作流
运维·chatgpt·自动化·ai编程·ai写作
落羽的落羽12 分钟前
【Linux系统】深入线程:多线程的互斥与同步原理,封装实现两种生产者消费者模型
java·linux·运维·服务器·c++·人工智能·python
博风17 分钟前
nginx:负载均衡
运维·nginx·负载均衡
爱莉希雅&&&1 小时前
Docker 部署 MySQL 双主双从同步架构详细笔记
linux·运维·数据库·mysql·docker·架构·主从同步
java资料站5 小时前
Docker 快速部署 MySQL 主从复制(一主一从)
mysql·adb·docker
Alex艾力的IT数字空间8 小时前
在 Kylin(麒麟)操作系统上搭建 Docker 环境
大数据·运维·缓存·docker·容器·负载均衡·kylin