Docker jetty应用程序看不到卷中的文件

时间:2015-08-15 14:07:21

标签: java permissions docker jetty volume

我有两个dockerized应用程序和额外的容器容器:

我的应用程序尝试从/home/git/data/repositories克隆git存储库。该目录由gitlab容器中的用户git拥有。但是在添加

之后
RUN groupadd --gid 1000 git && usermod -a -G git jetty

到Dockerfile,用户jetty查看其中的文件。我已经测试了它执行su - jettyls -la /home/git/data/repositories

JGit报告/home/git/data/repositories/<user>/<repo.git>不存在。我修改了app以记录实际存在的父目录,它是/home/git/data/repositories。我的java应用程序没有看到任何子目录。

但是当我使用:

连接到我的应用程序的容器时
docker exec -it my-app bash

将用户更改为jetty:

su - jetty

然后列出目录:

ls -la /home/git/data/repositories/<user>/<repo.git>

显示存储库存在!

确认服务器是否在此特定用户上运行:

$ ps auxwf
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root        72  0.0  0.0  21920  3556 ?        Ss   13:54   0:00 bash
root        77  0.0  0.0  46432  2920 ?        S    13:54   0:00  \_ su - jetty
jetty       78  0.0  0.0   4328   700 ?        S    13:54   0:00      \_ -su
jetty       81  0.0  0.0  17488  2072 ?        R+   13:54   0:00          \_ ps auxwf
jetty        1  0.5  5.7 5627056 464960 ?      Ssl  12:56   0:18 /usr/bin/java -Djetty.logging.dir=/usr/local/jetty/logs -Djetty.home=/usr/local/jetty -Djetty.base=/var/lib/jetty -Djava.io.tmpdir=/tmp/jett[...]

我真的不知道这里有什么问题。

你知道这可能是什么原因吗?

0 个答案:

没有答案