artifactory容器化部署的时候,使用的nginx容器和postgresql容器无法启动,一直处于重启状态,观察nginx容器的日志(docker logs -f nginx
)如下:
2019-02-20 18:08:32 [140 entrypoint-nginx.sh] Preparing to run Nginx in Docker
2019-02-20 18:08:32 [63 entrypoint-nginx.sh] Setting up directories if missing
2019-02-20 18:08:32 [128 entrypoint-nginx.sh] Unable to find Artifactory configuration (/var/opt/jfrog/nginx/conf.d/artifactory.conf). Copying a default one
cp: failed to access '/var/opt/jfrog/nginx/conf.d/artifactory.conf': Permission denied
2019-02-20 18:08:32 [31 31 functions.sh] ERROR: Copying /artifactory.conf to /var/opt/jfrog/nginx/conf.d/artifactory.conf failed
后来在网上查找资料发现,机器最开始的时候selinux的状态是enforcing,后来部署并启动了artifactory等容器,然后将selinux改为了disable,导致该问题。解决办法是,setenforce 0
。
下边是Stack Overflow上一个类似问题的答题者的原始回答:
I faced similar issue while restarting Nginx and found it to be a cause of SeLinux. Be sure to give a try after either disabling SeLinux or temporarily setting it to Permissive mode using below command:
setenforce 0
I hope it helps :)
问题链接:https://stackoverflow.com/questions/18714902/nginx-on-ubuntu-permission-denied