[英]Cannot `cd` into directory made by docker in a mounted volume
I'm running the following docker command:我正在运行以下 docker 命令:
docker run -v /data/polygon/mainnet:/data ghcr.io/streamingfast/firehose-ethereum:v1.2.2-polygon-v0.3.2-fh2.1 start reader-node --common-chain-id=137 --common-network-id=137 --data-dir=/data <other args>"
Note that I'm mounting /data/polygon/mai.net
to /data
and that /data
is being used as the data-dir
arg.请注意,我正在将
/data/polygon/mai.net
到/data
并且/data
被用作data-dir
arg。
When this container starts up, it creates files and folders in /data
in the container which I can see from the host:当这个容器启动时,它会在容器中的
/data
中创建文件和文件夹,我可以从主机上看到这些文件和文件夹:
12:11PM /data/polygon/mainnet
❯❯❯ ls
reader storage
However, when I try to cd
into one of the directories I get denied:但是,当我尝试
cd
进入其中一个目录时,我被拒绝了:
12:15PM /data/polygon/mainnet/reader ✘ 1
❯❯❯ cd /data/polygon/mainnet/reader/data
cd: permission denied: /data/polygon/mainnet/reader/data
12:15PM /data/polygon/mainnet/reader ✘ 1
❯❯❯ sudo !!
12:15PM /data/polygon/mainnet/reader ✘ 1
❯❯❯ sudo cd /data/polygon/mainnet/reader/data
sudo: cd: command not found
But, I can cd
into the `reader directory no problem:但是,我可以
cd
进入 `reader 目录没问题:
12:16PM /home/ubuntu
❮❮❮ cd /data/polygon/mainnet/reader
12:16PM /data/polygon/mainnet/reader
❯❯❯ ls
data work
If I list the folders under reader
I see the following如果我列出
reader
下的文件夹,我会看到以下内容
12:17PM /data/polygon/mainnet/reader
❯❯❯ ls -la
total 0
drwxr-xr-x 4 root 42 Jan 11 12:11 .
drwxr-xr-x 4 root 47 Jan 11 12:11 ..
drwx------ 4 root 33 Jan 11 12:11 data
drwxr-xr-x 3 root 41 Jan 11 12:11 work
Which is odd because the reader
directory is owned by root
, just like the data
directory.这很奇怪,因为
reader
目录归root
所有,就像data
目录一样。
Why can't I cd
into the data
directory?为什么我
cd
进入data
目录?
Ninja edit: turns out running chown -R ubuntu data
solves the issue. Ninja 编辑:原来运行
chown -R ubuntu data
解决了这个问题。 I do still wonder why I couldn't cd
into data
but I could cd
into reader
.我仍然想知道为什么我不能
cd
到data
但我可以cd
到reader
。
Credit to @KamilCuk for getting me to look into the specific permissions on the data
directory.感谢@KamilCuk 让我查看
data
目录的特定权限。
Looks like only the owner of the data
dir has permissions to read it.看起来只有
data
目录的所有者才有权读取它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.