2017-10-05 102 views
0

我使用'hyperledger/fabric-couchdb:x86_64-1.0.2'圖像在openshift上部署。 雖然我已經映射了上述路徑的持久性卷,但我仍然拒絕了'/opt/couchdb/etc/local.d'even的權限。獲取權限被拒絕,用於更改創建的文件和文件夾的權限

爲了解決這個問題,我嘗試通過創建自己的docker鏡像來更改'hyperledger/fabric-couchdb:x86_64-1.0.2'中定義的權限。

我已經創建了具有以下內容的Dockerfile。

FROM hyperledger/fabric-couchdb:x86_64-1.0.2 
RUN chgrp -R 0 /opt/couchdb/etc/local.d && chmod -R g=u /opt/couchdb/etc/local.d 

但是,當我試圖使用'碼頭構建'命令來構建這個圖像時,我得到了以下錯誤。

docker build . -t deepakmule/fabric-couchdb:x86_64-1.0.2 
Sending build context to Docker daemon 2.048 kB 
Step 1/2 : FROM hyperledger/fabric-couchdb:x86_64-1.0.2 
---> 3f922f54bd68 
Step 2/2 : RUN chgrp -R 0 /opt/couchdb/etc/local.d && chmod -R g=u  /opt/couchdb/etc/local.d 
---> Running in f06a386ecb01 
chgrp: changing group of '/opt/couchdb/etc/local.d/local.ini': Operation not  permitted 
chgrp: changing group of '/opt/couchdb/etc/local.d': Operation not permitted 
The command '/bin/sh -c chgrp -R 0 /opt/couchdb/etc/local.d && chmod -R g=u  /opt/couchdb/etc/local.d' returned a non-zero code: 1 

回答

0

我在這裏猜測一下:

上游Dockerfile有可能是USER命令。所以之後的所有命令都在該用戶下運行。您可以通過在chgrp命令之前添加USER root來解決該問題。之後再添加USER命令(查看上游Dockerfile設置了哪個用戶)。