我有以下 DockerFile
FROM apache/superset:pr-19860
RUN pip install elasticsearch-dbapi
RUN superset superset fab create-admin \
--username admin \
--firstname Superset \
--lastname Admin \
--email [email protected] \
--password admin
RUN superset superset db upgrade
RUN superset superset load_examples
RUN superset superset init
ADD https://github.com/domsoltel/superset/blob/436efe104938d0ca555bb99c586f3d2675a69a59/config.py /app/superset/
ADD https://github.com/domsoltel/superset/blob/436efe104938d0ca555bb99c586f3d2675a69a59/viz.py /app//superset/
我必須修改config.pyandviz.py檔案以使其按我想要的方式作業。這些檔案已經存在于超集容器中,但我需要修改一些變數
如果我做得docker cp很好,從我的電腦到容器它作業得很好但是使用 dockerfile 我得到以下錯誤
PermissionError:[Errno 13] 權限被拒絕:'/app/superset/config.py'
我認為這可能是權限問題,我該如何解決?
uj5u.com熱心網友回復:
超集影像設定為以superset沒有完全權限的用戶身份運行。因此,在您更改任何內容之前,您應該在完成后切換到用戶root,然后再回傳給superset用戶。
您可以在影像頁面底部看到一個示例(在“如何擴展此影像”下):https ://hub.docker.com/r/apache/superset
FROM apache/superset:pr-19860
USER root
RUN pip install elasticsearch-dbapi
RUN superset superset fab create-admin \
--username admin \
--firstname Superset \
--lastname Admin \
--email [email protected] \
--password admin
RUN superset superset db upgrade
RUN superset superset load_examples
RUN superset superset init
ADD --chown=superset:superset https://raw.githubusercontent.com/domsoltel/superset/436efe104938d0ca555bb99c586f3d2675a69a59/config.py /app/superset/
ADD --chown=superset:superset https://raw.githubusercontent.com/domsoltel/superset/436efe104938d0ca555bb99c586f3d2675a69a59/viz.py /app/superset/
RUN chmod 644 /app/superset/config.py && chmod 644 /app/superset/viz.py
USER superset
我還將檔案的 URL 更改為原始版本。使用您擁有的 URL,您將添加不起作用的檔案的 HTML 版本。
uj5u.com熱心網友回復:
由于您使用的是docker-compose; 然后使用卷來映射這些檔案
you_service:
image: .....
....
....
volumes:
- /home/config.py:/app/superset/config.py
- /home/viz.py:/app/superset/viz.py
請注意,卷必須是使用映射檔案的絕對路徑(與映射目錄不同)
另一個注意事項:如果檔案正在被容器使用;那么無論如何你都會得到權限錯誤!
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/473635.html
