首页 > 解决方案 > 为什么 `test -w /tv` 给出不正确的否定结果?

问题描述

这是那里的问题的派生

在树莓派上的 docker-container(Docker 版本 20.10.7)中,我有一个/tv由 docker 安装的 nfs mount()。

我不明白为什么 bash 错误地告诉我这个文件夹不可写:

root@6c5dd99ee211:/> if [ -w /tv ]; then echo "WRITABLE"; else echo "NOT WRITABLE"; fi
NOT WRITABLE
root@6c5dd99ee211:/> ls /tv/test
ls: cannot access '/tv/test': No such file or directory
root@6c5dd99ee211:/> touch /tv/test
root@6c5dd99ee211:/> ls /tv/test
/tv/test

它确实拥有所有权限:

root@7f0a44aad8a9:/> ls -la /tv
total 8
drwxrwxrwx 1 abc  abc   3826 Jul 27 14:18  .
drwxr-xr-x 1 root root  4096 Jul 27 14:12  ..
drwxrwxrwx 1 abc  abc    988 May 13 07:30 DARK
... (a lot of other folders)
-rwxrwxrwx 1 abc  abc      4 Jul 27 14:18  test

我的码头工人撰写文件:

version: "3.4"

services:
  bazarr:
    image: ghcr.io/linuxserver/bazarr
    container_name: bazarr
    volumes:
      - shows:/tv
    ports:
      - 6767:6767
    dns: 1.1.1.1
    restart: unless-stopped

volumes:
  shows:
    driver_opts:
      type: "nfs"
      o: "nfsvers=3,addr=xxx,soft,rw"
      device: ":xxx"

怎么了 ?

标签: linuxdockernfs

解决方案


推荐阅读